From 7ddf7be2a6d9f551483b903636e824c3fdb18e74 Mon Sep 17 00:00:00 2001 From: devhl Date: Thu, 12 Oct 2023 18:22:48 -0400 Subject: [PATCH 01/23] init --- .../generichost/JsonConverter.mustache | 36 ++--- .../generichost/ModelSignature.mustache | 2 +- .../generichost/OptionProperty.mustache | 1 + .../libraries/generichost/model.mustache | 2 +- .../generichost/modelGeneric.mustache | 12 +- .../.openapi-generator/VERSION | 2 +- .../src/Org.OpenAPITools/Model/Activity.cs | 12 +- .../ActivityOutputElementRepresentation.cs | 21 +-- .../Model/AdditionalPropertiesClass.cs | 72 +++------ .../src/Org.OpenAPITools/Model/Animal.cs | 16 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 30 ++-- .../src/Org.OpenAPITools/Model/Apple.cs | 30 ++-- .../src/Org.OpenAPITools/Model/AppleReq.cs | 16 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 12 +- .../Model/ArrayOfNumberOnly.cs | 12 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 30 ++-- .../src/Org.OpenAPITools/Model/Banana.cs | 12 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 14 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 5 +- .../Org.OpenAPITools/Model/Capitalization.cs | 57 +++---- .../src/Org.OpenAPITools/Model/Cat.cs | 23 ++- .../src/Org.OpenAPITools/Model/Category.cs | 16 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 21 +-- .../src/Org.OpenAPITools/Model/ClassModel.cs | 12 +- .../Model/ComplexQuadrilateral.cs | 9 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 5 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 14 +- .../Model/DeprecatedObject.cs | 12 +- .../src/Org.OpenAPITools/Model/Dog.cs | 23 ++- .../src/Org.OpenAPITools/Model/Drawing.cs | 33 ++-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 21 +-- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 74 ++++----- .../Model/EquilateralTriangle.cs | 9 +- .../src/Org.OpenAPITools/Model/File.cs | 12 +- .../Model/FileSchemaTestClass.cs | 21 +-- .../src/Org.OpenAPITools/Model/Foo.cs | 12 +- .../Model/FooGetDefaultResponse.cs | 12 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 152 +++++++----------- .../src/Org.OpenAPITools/Model/Fruit.cs | 14 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 20 ++- .../Model/GrandparentAnimal.cs | 5 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 21 +-- .../Model/HealthCheckResult.cs | 9 +- .../Model/IsoscelesTriangle.cs | 9 +- .../src/Org.OpenAPITools/Model/List.cs | 12 +- .../Model/LiteralStringClass.cs | 21 +-- .../src/Org.OpenAPITools/Model/Mammal.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 39 ++--- ...dPropertiesAndAdditionalPropertiesClass.cs | 39 ++--- .../Model/Model200Response.cs | 21 +-- .../src/Org.OpenAPITools/Model/ModelClient.cs | 12 +- .../src/Org.OpenAPITools/Model/Name.cs | 32 ++-- ...cationtestGetElementsV1ResponseMPayload.cs | 7 +- .../Org.OpenAPITools/Model/NullableClass.cs | 81 +++++----- .../Model/NullableGuidClass.cs | 9 +- .../Org.OpenAPITools/Model/NullableShape.cs | 5 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 12 +- .../Model/ObjectWithDeprecatedFields.cs | 39 ++--- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 + .../src/Org.OpenAPITools/Model/Order.cs | 57 +++---- .../Org.OpenAPITools/Model/OuterComposite.cs | 30 ++-- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 5 +- .../src/Org.OpenAPITools/Model/Pet.cs | 47 +++--- .../src/Org.OpenAPITools/Model/Pig.cs | 5 +- .../Model/PolymorphicProperty.cs | 1 + .../Org.OpenAPITools/Model/Quadrilateral.cs | 5 +- .../Model/QuadrilateralInterface.cs | 5 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 21 +-- .../src/Org.OpenAPITools/Model/Return.cs | 12 +- .../Model/RolesReportsHash.cs | 21 +-- .../Model/RolesReportsHashRole.cs | 12 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 9 +- .../src/Org.OpenAPITools/Model/Shape.cs | 5 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 5 +- .../Model/SimpleQuadrilateral.cs | 9 +- .../Model/SpecialModelName.cs | 21 +-- .../src/Org.OpenAPITools/Model/Tag.cs | 21 +-- .../Model/TestCollectionEndingWithWordList.cs | 12 +- .../TestCollectionEndingWithWordListObject.cs | 12 +- ...lineFreeformAdditionalPropertiesRequest.cs | 12 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 5 +- .../Model/TriangleInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 102 +++++------- .../src/Org.OpenAPITools/Model/Whale.cs | 25 ++- .../src/Org.OpenAPITools/Model/Zebra.cs | 16 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 12 +- .../.openapi-generator/VERSION | 2 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 16 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 2 +- .../src/Org.OpenAPITools/Model/Order.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 2 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 2 +- .../Model/ZeroBasedEnumClass.cs | 2 +- 105 files changed, 750 insertions(+), 1077 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache 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 e2aa6a74d6a5..33bcf3226d60 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 @@ -38,7 +38,7 @@ JsonTokenType startingTokenType = utf8JsonReader.TokenType; {{#allVars}} - {{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; + {{^required}}Option<{{/required}}{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; {{#-last}} {{/-last}} @@ -117,7 +117,7 @@ {{#anyOf}} {{^vendorExtensions.x-duplicated-data-type}} - {{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; + {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; {{#-last}} Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; @@ -167,39 +167,39 @@ {{^isMap}} {{^isEnum}} {{^isUuid}} - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.GetString(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetString(){{^nullable}}{{nrt!}}{{/nullable}}{{^required}}){{/required}}; {{/isUuid}} {{/isEnum}} {{/isMap}} {{/isString}} {{#isBoolean}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.GetBoolean(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetBoolean(){{^required}}){{/required}}; {{/isBoolean}} {{#isNumeric}} {{^isEnum}} {{#isDouble}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.GetDouble(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDouble(){{^required}}){{/required}}; {{/isDouble}} {{#isDecimal}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.GetDecimal(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDecimal(){{^required}}){{/required}}; {{/isDecimal}} {{#isFloat}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = (float)utf8JsonReader.GetDouble(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}(float)utf8JsonReader.GetDouble(){{^required}}){{/required}}; {{/isFloat}} {{#isLong}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64(){{^required}}){{/required}}; {{/isLong}} {{^isLong}} {{^isFloat}} {{^isDecimal}} {{^isDouble}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(){{^required}}){{/required}}; {{/isDouble}} {{/isDecimal}} {{/isFloat}} @@ -208,36 +208,36 @@ {{/isNumeric}} {{#isDate}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions){{^required}}){{/required}}; {{/isDate}} {{#isDateTime}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions){{^required}}){{/required}}; {{/isDateTime}} {{#isEnum}} {{^isMap}} {{#isNumeric}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = ({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(){{^required}}){{/required}}; {{/isNumeric}} {{^isNumeric}} string{{nrt?}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = utf8JsonReader.GetString(); {{^isInnerEnum}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue == null ? null - : {{{datatypeWithEnum}}}ValueConverter.FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); + : {{>OptionProperty}}{{{datatypeWithEnum}}}ValueConverter.FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue){{^required}}){{/required}}; {{/isInnerEnum}} {{#isInnerEnum}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue == null ? null - : {{classname}}.{{{datatypeWithEnum}}}FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); + : {{>OptionProperty}}{{classname}}.{{{datatypeWithEnum}}}FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue){{^required}}){{/required}}; {{/isInnerEnum}} {{/isNumeric}} {{/isMap}} {{/isEnum}} {{#isUuid}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = utf8JsonReader.GetGuid(); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetGuid(){{^required}}){{/required}}; {{/isUuid}} {{^isUuid}} {{^isEnum}} @@ -247,7 +247,7 @@ {{^isDate}} {{^isDateTime}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions); + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^nullable}}{{nrt!}}{{/nullable}}{{^required}}){{/required}}; {{/isDateTime}} {{/isDate}} {{/isNumeric}} @@ -264,11 +264,11 @@ } {{#allVars}} - {{^isNullable}} + {{#required}} if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null) throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}), "Property is required for class {{classname}}."); - {{/isNullable}} + {{/required}} {{/allVars}} {{^vendorExtensions.x-duplicated-data-type}} {{#model.discriminator}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache index 0e7bbc90e6bc..80da5edd915c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache @@ -1 +1 @@ -{{#model.allVars}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = default{{/isNullable}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file +{{#model.allVars}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = default{{/isNullable}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache new file mode 100644 index 000000000000..c6a7d58779cd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache @@ -0,0 +1 @@ +{{^required}}new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>({{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/model.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/model.mustache index f11dd9ba2b06..f9931574dcf5 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/model.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/model.mustache @@ -26,8 +26,8 @@ using OpenAPIClientUtils = {{packageName}}.Client.ClientUtils; {{#useGenericHost}} {{#useSourceGeneration}} using System.Text.Json.Serialization.Metadata; -using {{packageName}}.{{clientPackage}}; {{/useSourceGeneration}} +using {{packageName}}.{{clientPackage}}; {{/useGenericHost}} {{#models}} {{#lambda.trimTrailingWithNewLine}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 5667892c0b11..8ac155899e40 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -15,7 +15,7 @@ {{#allVars}} /// {{description}}{{^description}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/description}}{{#defaultValue}} (default to {{.}}){{/defaultValue}} {{/allVars}} - {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{#model.composedSchemas.anyOf}}{{{dataType}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} + {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{#model.composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} { {{#composedSchemas.anyOf}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; @@ -49,7 +49,7 @@ {{^composedSchemas.anyOf}} [JsonConstructor] {{/composedSchemas.anyOf}} - {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.anyOf}}{{{name}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} + {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{name}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} { {{#composedSchemas.anyOf}} {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; @@ -97,7 +97,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{#isNew}}new {{/isNew}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} {{/isEnum}} {{/vars}} @@ -113,7 +113,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{dataType}}}{{>NullConditionalProperty}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} {{/vendorExtensions.x-duplicated-data-type}} {{/composedSchemas.anyOf}} @@ -148,7 +148,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public new {{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public new {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} {{/isNew}} {{/isInherited}} @@ -164,7 +164,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} {{/isInherited}} {{/isEnum}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index 22464eec75fe..f48753ed0719 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs) { ActivityOutputs = activityOutputs; OnCreated(); @@ -47,7 +48,7 @@ public Activity(Dictionary> ac /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Option>> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary>? activityOutputs = default; + Option>> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,9 +130,6 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); - return new Activity(activityOutputs); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 39c2e8b05e60..9fc9cb7ee243 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1, Option prop2) { Prop1 = prop1; Prop2 = prop2; @@ -49,13 +50,13 @@ public ActivityOutputElementRepresentation(string prop1, Object prop2) /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public Option Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Option Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? prop1 = default; - Object? prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -130,11 +131,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -142,12 +143,6 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); - - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 37ab8b4f3b4a..c928bac3f7e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -42,7 +43,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap, Option>> mapOfMapProperty, Option> mapProperty, Option mapWithUndeclaredPropertiesAnytype1, Option mapWithUndeclaredPropertiesAnytype2, Option> mapWithUndeclaredPropertiesAnytype3, Option> mapWithUndeclaredPropertiesString, Option anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -62,49 +63,49 @@ public AdditionalPropertiesClass(Object emptyMap, Dictionary /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Option EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Option>> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Option> MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Option> MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get; set; } + public Option Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -166,14 +167,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object? emptyMap = default; - Dictionary>? mapOfMapProperty = default; - Dictionary? mapProperty = default; - Object? mapWithUndeclaredPropertiesAnytype1 = default; - Object? mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary? mapWithUndeclaredPropertiesString = default; - Object? anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -192,35 +193,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -228,27 +229,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); - - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index dd36cad83283..38056119e036 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = @"red") { ClassName = className; Color = color; @@ -55,7 +56,7 @@ public Animal(string className, string color = @"red") /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -121,8 +122,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - string? color = default; + string className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -140,10 +141,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -154,9 +155,6 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (className == null) throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); - return new Animal(className, color); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index a9e4c983c629..1395de921320 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code, Option message, Option type) { Code = code; Message = message; @@ -51,19 +52,19 @@ public ApiResponse(int code, string message, string type) /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public Option Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public Option Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets additional properties @@ -120,9 +121,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string? message = default; - string? type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -141,13 +142,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()!); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -155,15 +156,6 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); - - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); - - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); - return new ApiResponse(code.Value, message, type); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index 39c4ddd6c25b..c1e35ffd5f9c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode, Option cultivar, Option origin) { ColorCode = colorCode; Cultivar = cultivar; @@ -51,19 +52,19 @@ public Apple(string colorCode, string cultivar, string origin) /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public Option ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public Option Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public Option Origin { get; set; } /// /// Gets or Sets additional properties @@ -147,9 +148,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? colorCode = default; - string? cultivar = default; - string? origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -167,13 +168,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()!); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -181,15 +182,6 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); - - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); - - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); - return new Apple(colorCode, cultivar, origin); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index ca139374d181..e190014b4a19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy) { Cultivar = cultivar; Mealy = mealy; @@ -55,7 +56,7 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public Option Mealy { get; set; } /// /// Returns the string presentation of the object @@ -104,8 +105,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? cultivar = default; - bool? mealy = default; + string cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -123,11 +124,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = utf8JsonReader.GetString()!; break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -138,9 +139,6 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (cultivar == null) throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 78ae23d63d61..abae0ad9fcc7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -47,7 +48,7 @@ public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public Option>> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayNumber = default; + Option>> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,9 +130,6 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 29af43d6c8b3..9474e34f4246 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber) { ArrayNumber = arrayNumber; OnCreated(); @@ -47,7 +48,7 @@ public ArrayOfNumberOnly(List arrayNumber) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public Option> ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayNumber = default; + Option> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,9 +130,6 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index c021f61cca54..03df0c48f345 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger, Option>> arrayArrayOfModel, Option> arrayOfString) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -51,19 +52,19 @@ public ArrayTest(List> arrayArrayOfInteger, List> /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public Option>> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public Option>> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public Option> ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -120,9 +121,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayOfInteger = default; - List>? arrayArrayOfModel = default; - List? arrayOfString = default; + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -141,15 +142,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -157,15 +158,6 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); - - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); - - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index a73515d6023b..0fb247cc7007 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm) { LengthCm = lengthCm; OnCreated(); @@ -47,7 +48,7 @@ public Banana(decimal lengthCm) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public Option LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,9 +130,6 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); - return new Banana(lengthCm.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index 20d095383d78..f2378cd20c18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet) { LengthCm = lengthCm; Sweet = sweet; @@ -55,7 +56,7 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public Option Sweet { get; set; } /// /// Returns the string presentation of the object @@ -104,8 +105,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + decimal lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -128,7 +129,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -139,9 +140,6 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (lengthCm == null) throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 87c83d423c17..aeccef64f967 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,7 +103,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 53520c57a3d9..13eb885c1fb6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +41,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME, Option capitalCamel, Option capitalSnake, Option sCAETHFlowPoints, Option smallCamel, Option smallSnake) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -58,37 +59,37 @@ public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public Option ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public Option CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public Option CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public Option SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public Option SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public Option SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -148,12 +149,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? aTTNAME = default; - string? capitalCamel = default; - string? capitalSnake = default; - string? sCAETHFlowPoints = default; - string? smallCamel = default; - string? smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -171,22 +172,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()!); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()!); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()!); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()!); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,24 +195,6 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); - - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); - - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); - - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); - - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); - - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 2a0960e3a903..c066b2425c7e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed, Option color = @"red") : base(className, color) { Declawed = declawed; OnCreated(); @@ -49,7 +50,7 @@ public Cat(string className, bool declawed, string color = @"red") : base(classN /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public Option Declawed { get; set; } /// /// Returns the string presentation of the object @@ -88,9 +89,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? declawed = default; - string? color = default; + string className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -108,14 +109,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -126,12 +127,6 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (className == null) throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); - - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); - return new Cat(className, declawed.Value, color); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 714575af8f4d..18ac3881d14a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Category : IValidatableObject /// id /// name (default to "default-name") [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(Option id, string name = @"default-name") { Id = id; Name = name; @@ -49,7 +50,7 @@ public Category(long id, string name = @"default-name") /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name @@ -111,8 +112,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option id = default; + string name = default; while (utf8JsonReader.Read()) { @@ -131,10 +132,10 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = utf8JsonReader.GetString()!; break; default: break; @@ -142,9 +143,6 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - if (name == null) throw new ArgumentNullException(nameof(name), "Property is required for class Category."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index 2d39883e18b2..34e63898af12 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name, Option petType = new Option(PetTypeEnum.ChildCat)) : base(ChildCat.PetTypeEnumToJsonValue(petType)) { Name = name; PetType = petType; @@ -101,13 +102,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new Option PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Returns the string presentation of the object @@ -147,8 +148,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -166,13 +167,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); petType = petTypeRawValue == null ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + : new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -180,12 +181,6 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); - - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); - return new ChildCat(name, petType.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 66a7dee91d88..7c4e17371b86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass) { VarClass = varClass; OnCreated(); @@ -47,7 +48,7 @@ public ClassModel(string varClass) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); - return new ClassModel(varClass); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 01f2390005d2..c56c40984ea3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,8 +112,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = utf8JsonReader.GetString()!; break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index fd9ee9d36830..62de2a24e9cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,7 +103,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 6a9c5d4a7952..927d4ad38f20 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -46,9 +47,9 @@ public DateOnlyClass(DateTime dateOnlyProperty) /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public Option DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -108,7 +109,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -127,7 +128,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -135,9 +136,6 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 84ebd0792c33..fe43a737e6d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name) { Name = name; OnCreated(); @@ -47,7 +48,7 @@ public DeprecatedObject(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); - return new DeprecatedObject(name); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index fa2bab080244..6fa73d997969 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class Dog : Animal, IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(Option breed, string className, Option color = @"red") : base(className, color) { Breed = breed; OnCreated(); @@ -49,7 +50,7 @@ public Dog(string breed, string className, string color = @"red") : base(classNa /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public Option Breed { get; set; } /// /// Returns the string presentation of the object @@ -88,9 +89,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? breed = default; - string? className = default; - string? color = default; + Option breed = default; + string className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -108,13 +109,13 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "breed": - breed = utf8JsonReader.GetString(); + breed = new Option(utf8JsonReader.GetString()!); break; case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -122,15 +123,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - if (className == null) throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); - return new Dog(breed, className, color); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 8f5fff0f79a0..0822fec42f7e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() + public Drawing(Option mainShape, Option> shapes, Option nullableShape = default, Option shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -53,25 +54,25 @@ public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Option MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public Option> Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get; set; } + public Option NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get; set; } + public Option ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -140,10 +141,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape? mainShape = default; - List? shapes = default; - NullableShape? nullableShape = default; - ShapeOrNull? shapeOrNull = default; + Option mainShape = default; + Option> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -162,19 +163,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -182,12 +183,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); - - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index 431924ef1e6c..0f0cd978b3e3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum, Option justSymbol) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -181,13 +182,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public Option JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public Option> ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -243,8 +244,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -263,13 +264,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); justSymbol = justSymbolRawValue == null ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + : new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -277,12 +278,6 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); - - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs index 76dcba15b394..03b2780c4842 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 6ea096d90414..ce3ce40cbf69 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -43,7 +44,7 @@ public partial class EnumTest : IValidatableObject /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(Option enumInteger, Option enumIntegerOnly, Option enumNumber, Option enumString, EnumStringRequiredEnum enumStringRequired, Option outerEnumDefaultValue, Option outerEnumInteger, Option outerEnumIntegerDefaultValue, Option outerEnum = default) { EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; @@ -122,7 +123,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public Option EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -187,7 +188,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public Option EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -259,7 +260,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public Option EnumNumber { get; set; } /// /// Defines EnumString @@ -415,7 +416,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + public Option EnumString { get; set; } /// /// Defines EnumStringRequired @@ -577,25 +578,25 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + public Option OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + public Option OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + public Option OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public Option OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -658,15 +659,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + EnumTest.EnumStringRequiredEnum enumStringRequired = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -685,21 +686,21 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); enumString = enumStringRawValue == null ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); + : new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "enum_string_required": string? enumStringRequiredRawValue = utf8JsonReader.GetString(); @@ -711,25 +712,25 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); outerEnumDefaultValue = outerEnumDefaultValueRawValue == null ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + : new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); outerEnumInteger = outerEnumIntegerRawValue == null ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + : new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + : new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); outerEnum = outerEnumRawValue == null ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + : new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -737,30 +738,9 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); - - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); - - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); - - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); - if (enumStringRequired == null) throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); - - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); - - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 717de0e356f4..5f0ac3ed7641 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,8 +112,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index f0e27f10fa32..5b2d5f7ad6c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI) { SourceURI = sourceURI; OnCreated(); @@ -48,7 +49,7 @@ public File(string sourceURI) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public Option SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +104,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,9 +130,6 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); - return new File(sourceURI); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index da341a59421b..31abeac04212 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file, Option> files) { File = file; Files = files; @@ -49,13 +50,13 @@ public FileSchemaTestClass(File file, List files) /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public Option File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public Option> Files { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File? file = default; - List? files = default; + Option file = default; + Option> files = default; while (utf8JsonReader.Read()) { @@ -131,11 +132,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -143,12 +144,6 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); - - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index 3628416eb0d0..fa3c1cf8c55a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = @"bar") { Bar = bar; OnCreated(); @@ -47,7 +48,7 @@ public Foo(string bar = @"bar") /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public Option Bar { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); - return new Foo(bar); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 6f2670034f24..15bac1f9d5b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString) { VarString = varString; OnCreated(); @@ -47,7 +48,7 @@ public FooGetDefaultResponse(Foo varString) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo? varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,9 +130,6 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 9066cc903b6a..d1303e5362e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -53,7 +54,7 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(Option binary, byte[] varByte, DateTime date, Option dateTime, Option varDecimal, Option varDouble, Option varFloat, Option int32, Option int64, Option integer, decimal number, string password, Option patternWithBackslash, Option patternWithDigits, Option patternWithDigitsAndDelimiter, Option varString, Option unsignedInteger, Option unsignedLong, Option uuid) { Binary = binary; VarByte = varByte; @@ -83,7 +84,7 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// Gets or Sets Binary /// [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } + public Option Binary { get; set; } /// /// Gets or Sets VarByte @@ -94,7 +95,7 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } @@ -103,43 +104,43 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public Option VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public Option VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public Option VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public Option Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public Option Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int Integer { get; set; } + public Option Integer { get; set; } /// /// Gets or Sets Number @@ -158,46 +159,46 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public Option PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public Option PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public Option PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public Option UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public Option UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -400,25 +401,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream? binary = default; - byte[]? varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string? password = default; - string? patternWithBackslash = default; - string? patternWithDigits = default; - string? patternWithDigitsAndDelimiter = default; - string? varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option binary = default; + byte[] varByte = default; + DateTime date = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + decimal number = default; + string password = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -437,11 +438,11 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "binary": if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!; break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) @@ -449,62 +450,62 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "number": if (utf8JsonReader.TokenType != JsonTokenType.Null) number = utf8JsonReader.GetDecimal(); break; case "password": - password = utf8JsonReader.GetString(); + password = utf8JsonReader.GetString()!; break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -512,63 +513,18 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - if (varByte == null) throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); if (date == null) throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); - - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); - - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); - - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); - - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); - - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); - - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); - if (number == null) throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); if (password == null) throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); - - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); - - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); - - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); - - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); - - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index c3e213f48a47..dd6b996755c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color) { Apple = apple; Color = color; @@ -47,7 +48,7 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color) { Banana = banana; Color = color; @@ -70,7 +71,7 @@ public Fruit(Banana banana, string color) /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -118,7 +119,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -158,7 +159,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -166,9 +167,6 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); - if (apple != null) return new Fruit(apple, color); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs index 56212b9c18dd..46c3c3b25407 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 9ed8b2db2d15..4cdcb67c2a85 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple? apple, Banana? banana, string color) + public GmFruit(Option apple, Option banana, Option color) { Apple = apple; Banana = banana; @@ -49,18 +50,18 @@ public GmFruit(Apple? apple, Banana? banana, string color) /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Option Apple { get; set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Option Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -108,10 +109,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; - Apple? apple = default; - Banana? banana = default; + Option apple = default; + Option banana = default; Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; while (utf8JsonReaderAnyOf.Read()) @@ -148,7 +149,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -156,9 +157,6 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); - return new GmFruit(apple, banana, color); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index cb7fe43f91cb..b7d770efc85f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,7 +113,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -130,7 +131,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 3b8c651908c8..a9653d3695a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar, Option foo) { Bar = bar; Foo = foo; @@ -49,13 +50,13 @@ internal HasOnlyReadOnly(string bar, string foo) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public Option Foo { get; } /// /// Gets or Sets additional properties @@ -148,8 +149,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -167,10 +168,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -178,12 +179,6 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); - - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index ccdc21a06856..5436159dac7c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string? nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -47,7 +48,7 @@ public HealthCheckResult(string? nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get; set; } + public Option NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()!); break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f33f99e6dfbf..f1bc144175a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -104,8 +105,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -123,10 +124,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index 8f55db6ee70d..1f4e6e63c40a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List) { Var123List = var123List; OnCreated(); @@ -47,7 +48,7 @@ public List(string var123List) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public Option Var123List { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); - return new List(var123List); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8253e7ac7bc8..b6146717fb81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = @"C:\\Users\\username", Option unescapedLiteralString = @"C:\Users\username") { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -49,13 +50,13 @@ public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public Option EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public Option UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? escapedLiteralString = default; - string? unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()!); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,12 +142,6 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); - - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index 0910cbbb0a17..dd35fe079925 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -152,7 +153,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + string className = default; Pig? pig = null; Whale? whale = null; @@ -209,7 +210,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index e29d198fe46b..621519be0188 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap, Option> indirectMap, Option>> mapMapOfString, Option> mapOfEnumString) { DirectMap = directMap; IndirectMap = indirectMap; @@ -119,25 +120,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Option> DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Option> IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Option>> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Option> MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -195,10 +196,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary? directMap = default; - Dictionary? indirectMap = default; - Dictionary>? mapMapOfString = default; - Dictionary? mapOfEnumString = default; + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -217,19 +218,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -237,18 +238,6 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); - - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); - - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); - - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ea2d79b05d2..060bcc07d9ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime, Option> map, Option uuid, Option uuidWithPattern) { DateTime = dateTime; Map = map; @@ -53,25 +54,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Option> Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Option UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -140,10 +141,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary? map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -162,19 +163,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -182,18 +183,6 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index b017d0715831..fd618a1a9fc2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass, Option name) { VarClass = varClass; Name = name; @@ -49,13 +50,13 @@ public Model200Response(string varClass, int name) /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -130,11 +131,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -142,12 +143,6 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); - - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); - return new Model200Response(varClass, name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 1883e1d09c88..21177681a89a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient) { VarClient = varClient; OnCreated(); @@ -47,7 +48,7 @@ public ModelClient(string varClient) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public Option VarClient { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); - return new ModelClient(varClient); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 83161d26894d..22ac8a75383e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property, Option snakeCase, Option var123Number) { VarName = varName; Property = property; @@ -59,19 +60,19 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public Option Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public Option SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public Option Var123Number { get; } /// /// Gets or Sets additional properties @@ -166,10 +167,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string? property = default; - int? snakeCase = default; - int? var123Number = default; + int varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -191,15 +192,15 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, varName = utf8JsonReader.GetInt32(); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -210,15 +211,6 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (varName == null) throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); - - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); - - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 23f7775d8909..1f7bca895c6f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,8 +112,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? aObjVariableobject = default; - int? pkiNotificationtestID = default; + List> aObjVariableobject = default; + int pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -131,7 +132,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!; break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 916746334975..8864e1b9098f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -46,7 +47,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable, Option> objectItemsNullable, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -69,73 +70,73 @@ public NullableClass(List arrayItemsNullable, Dictionary /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public Option> ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Option> ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get; set; } + public Option?> ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get; set; } + public Option?> ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public Option BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public Option DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public Option DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public Option IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public Option NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get; set; } + public Option?> ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get; set; } + public Option?> ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get; set; } + public Option StringProp { get; set; } /// /// Gets or Sets additional properties @@ -222,18 +223,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayItemsNullable = default; - Dictionary? objectItemsNullable = default; - List? arrayAndItemsNullableProp = default; - List? arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary? objectAndItemsNullableProp = default; - Dictionary? objectNullableProp = default; - string? stringProp = default; + Option> arrayItemsNullable = default; + Option> objectItemsNullable = default; + Option?> arrayAndItemsNullableProp = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -252,50 +253,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -303,12 +304,6 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); - - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index b5d1bc4e4200..698c9f7969dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { Uuid = uuid; OnCreated(); @@ -48,7 +49,7 @@ public NullableGuidClass(Guid? uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +104,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -122,7 +123,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index c6f4dea35852..a3760690e8c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -135,7 +136,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + string shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index 3e05a1954548..d176b00bd66f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber) { JustNumber = justNumber; OnCreated(); @@ -47,7 +48,7 @@ public NumberOnly(decimal justNumber) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public Option JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,9 +130,6 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); - return new NumberOnly(justNumber.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 84957dfb4699..671a8061c8e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars, Option deprecatedRef, Option id, Option uuid) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -54,27 +55,27 @@ public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecated /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public Option> Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public Option DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -132,10 +133,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? bars = default; - DeprecatedObject? deprecatedRef = default; - decimal? id = default; - string? uuid = default; + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -154,18 +155,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -173,18 +174,6 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); - - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); - - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs index e84b8aae250e..a0a54c250670 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 940d22bbd0c1..4f608ed18b9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +41,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id, Option petId, Option quantity, Option shipDate, Option status, Option complete = false) { Id = id; PetId = petId; @@ -139,38 +140,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public Option PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public Option Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public Option ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public Option Complete { get; set; } /// /// Gets or Sets additional properties @@ -235,12 +236,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -259,29 +260,29 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); status = statusRawValue == null ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + : new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -289,24 +290,6 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); - - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); - - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); - - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); - - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); - - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 944b48cec72f..a36ae5eb0f18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean, Option myNumber, Option myString) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -51,19 +52,19 @@ public OuterComposite(bool myBoolean, decimal myNumber, string myString) /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public Option MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public Option MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public Option MyString { get; set; } /// /// Gets or Sets additional properties @@ -120,9 +121,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string? myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -141,14 +142,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -156,15 +157,6 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); - - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); - - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs index 01f4f4676274..96af6f3670d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7903c8296487..a50d5c056ecc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index a09978af1c35..41ecebcf8f5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 4a73f8886ac8..902dbb066392 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 9a549df1f0aa..03a8ccdecacd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 73fc6e3e5ede..08ebfe841a90 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -78,7 +79,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -96,7 +97,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 6705bb4138eb..63d504dc1f59 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +41,7 @@ public partial class Pet : IValidatableObject /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(Option category, Option id, string name, List photoUrls, Option status, Option> tags) { Category = category; Id = id; @@ -139,19 +140,19 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get; set; } + public Option Category { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name @@ -170,7 +171,7 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public Option> Tags { get; set; } /// /// Gets or Sets additional properties @@ -230,12 +231,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category? category = default; - long? id = default; - string? name = default; - List? photoUrls = default; - Pet.StatusEnum? status = default; - List? tags = default; + Option category = default; + Option id = default; + string name = default; + List photoUrls = default; + Option status = default; + Option> tags = default; while (utf8JsonReader.Read()) { @@ -254,28 +255,28 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "category": if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = utf8JsonReader.GetString()!; break; case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!; break; case "status": string? statusRawValue = utf8JsonReader.GetString(); status = statusRawValue == null ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + : new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -283,24 +284,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - if (name == null) throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); if (photoUrls == null) throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); - - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index 07ecf267e656..a63753422d6f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -135,7 +136,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + string className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -186,7 +187,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 2093843c8d9e..1333f4a725d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 2ac725986a2a..40e136136650 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -135,7 +136,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + string quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -186,7 +187,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index a0be19661249..2127a01bb2b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,7 +103,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + string quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 7dae6b8bb181..f9fda3b97c52 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar, Option baz) { Bar = bar; Baz = baz; @@ -49,13 +50,13 @@ public ReadOnlyFirst(string bar, string baz) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public Option Baz { get; set; } /// /// Gets or Sets additional properties @@ -147,8 +148,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -166,10 +167,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -177,12 +178,6 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); - - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index 262ecadf740b..451899418820 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn) { VarReturn = varReturn; OnCreated(); @@ -47,7 +48,7 @@ public Return(int varReturn) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public Option VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -129,9 +130,6 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); - return new Return(varReturn.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index f7be23ecece4..947df05311f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role, Option roleUuid) { Role = role; RoleUuid = roleUuid; @@ -49,13 +50,13 @@ public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public Option Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Option RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole? role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -131,11 +132,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -143,12 +144,6 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); - - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index f64e8c9cd62e..7cdf087c8c5f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name) { Name = name; OnCreated(); @@ -47,7 +48,7 @@ public RolesReportsHashRole(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 9e9dc21151e0..e08db2ae55d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,8 +112,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index d8fbc094d19c..c951f90f2e15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -135,7 +136,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + string shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 1b0a8291f383..2770c2092b87 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,7 +103,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 1b75eada511b..d935935466ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -135,7 +136,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + string shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 8945a243dfd2..95b31cbbe391 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,8 +112,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = utf8JsonReader.GetString()!; break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 39baf9d3e4f0..40a6ca2bde40 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName, Option specialPropertyName) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -49,13 +50,13 @@ public SpecialModelName(string varSpecialModelName, long specialPropertyName) /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public Option VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public Option SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -130,11 +131,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -142,12 +143,6 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); - - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index 1f69557e7d73..0e2d3c0f9844 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id, Option name) { Id = id; Name = name; @@ -49,13 +50,13 @@ public Tag(long id, string name) /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -131,10 +132,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,12 +143,6 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); - - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); - return new Tag(id.Value, name); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index fa286e8f3fd6..c3cb3e930bfa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value) { Value = value; OnCreated(); @@ -47,7 +48,7 @@ public TestCollectionEndingWithWordList(string value) /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public Option Value { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,9 +129,6 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5c481470c71a..93020137dddb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -47,7 +48,7 @@ public TestCollectionEndingWithWordListObject(List [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public Option> TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? testCollectionEndingWithWordList = default; + Option> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,9 +130,6 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 95ad0601f978..602a2c7f6c61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty) : base() { SomeProperty = someProperty; OnCreated(); @@ -47,7 +48,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public Option SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -113,7 +114,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -131,7 +132,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -139,9 +140,6 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index c75c83f7d54b..18f52e625e4c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -152,7 +153,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + string triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -209,7 +210,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index a724643f7327..a7f5a23391b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,7 +103,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = utf8JsonReader.GetString()!; break; default: break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 32df8b267426..b96ac1bb482d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -46,7 +47,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) + public User(Option email, Option firstName, Option id, Option lastName, Option objectWithNoDeclaredProps, Option password, Option phone, Option userStatus, Option username, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -69,78 +70,78 @@ public User(string email, string firstName, long id, string lastName, Object obj /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public Option Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public Option FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public Option LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Option ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public Option Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public Option Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public Option UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public Option Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get; set; } + public Option AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get; set; } + public Option AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get; set; } + public Option ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -206,18 +207,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? email = default; - string? firstName = default; - long? id = default; - string? lastName = default; - Object? objectWithNoDeclaredProps = default; - string? password = default; - string? phone = default; - int? userStatus = default; - string? username = default; - Object? anyTypeProp = default; - Object? anyTypePropNullable = default; - Object? objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -235,46 +236,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()!); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()!); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -282,33 +283,6 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); - - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); - - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); - - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); - - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); - - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); - - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); - - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 59099f90e2de..06035e5d63bf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen, Option hasTeeth) { ClassName = className; HasBaleen = hasBaleen; @@ -57,13 +58,13 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public Option HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public Option HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -120,9 +121,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + string className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -140,15 +141,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -159,12 +160,6 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (className == null) throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); - - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index 16af2edc89db..faf8a0789e2b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type) : base() { ClassName = className; Type = type; @@ -129,7 +130,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets ClassName @@ -202,8 +203,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - Zebra.TypeEnum? type = default; + string className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -221,13 +222,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = utf8JsonReader.GetString()!; break; case "type": string? typeRawValue = utf8JsonReader.GetString(); type = typeRawValue == null ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + : new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -238,9 +239,6 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (className == null) throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); - return new Zebra(className, type.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 60223b9ff74f..1db14d35a9e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index b83809de7fb2..4ea71d55737b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -113,7 +114,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public Option ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -168,7 +169,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -189,7 +190,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); zeroBasedEnum = zeroBasedEnumRawValue == null ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + : new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -197,9 +198,6 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index 367e08ca3d32..da1b80e469d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -99,7 +99,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new Option PetType { get; set; } /// /// Gets or Sets Name diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 4420630af349..191385faf9b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -44,7 +44,7 @@ public DateOnlyClass(DateTime dateOnlyProperty) /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] public DateTime DateOnlyProperty { get; set; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 37e06cb37e3c..7587db930992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -179,7 +179,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public Option JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index 1d1ed947dc47..3e04c40d9467 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -120,7 +120,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public Option EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -185,7 +185,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public Option EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -257,7 +257,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public Option EnumNumber { get; set; } /// /// Defines EnumString @@ -413,7 +413,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + public Option EnumString { get; set; } /// /// Defines EnumStringRequired @@ -575,25 +575,25 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + public Option OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + public Option OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + public Option OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public Option OuterEnum { get; set; } /// /// Gets or Sets additional properties diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index 30a9b189932a..de2fe5e720e6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -92,7 +92,7 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index 13afecfac3f6..d9755f353b5a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -137,7 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Id diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index aa380014a324..861c306e1544 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -137,7 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Category diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 503c47228cdf..eb62c6690959 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -127,7 +127,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets ClassName diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index c590ea6644ba..7ed6ad24a483 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -111,7 +111,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public Option ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties From 3196c359f6210bfe24975b4b0b26ac656cf36431 Mon Sep 17 00:00:00 2001 From: devhl Date: Sat, 14 Oct 2023 23:15:02 -0400 Subject: [PATCH 02/23] fixed read and write --- .../languages/AbstractCSharpCodegen.java | 14 +- .../languages/CSharpClientCodegen.java | 14 +- .../templating/mustache/CopyLambda.java | 48 + .../templating/mustache/PasteLambda.java | 66 + .../generichost/JsonConverter.mustache | 249 +- .../generichost/ModelBaseSignature.mustache | 2 +- .../generichost/ModelSignature.mustache | 2 +- .../generichost/OptionProperty.mustache | 2 +- .../generichost/WriteProperty.mustache | 9 + .../generichost/WritePropertyHelper.mustache | 9 + .../resources/csharp/modelInnerEnum.mustache | 6 +- ...odels-for-testing-with-http-signature.yaml | 262 ++ .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 74 + .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Model/Activity.cs | 22 +- .../ActivityOutputElementRepresentation.cs | 33 +- .../Model/AdditionalPropertiesClass.cs | 133 +- .../src/Org.OpenAPITools/Model/Animal.cs | 28 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 38 +- .../src/Org.OpenAPITools/Model/Apple.cs | 44 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 28 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 22 +- .../Model/ArrayOfNumberOnly.cs | 22 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 54 +- .../src/Org.OpenAPITools/Model/Banana.cs | 16 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 28 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 13 +- .../Org.OpenAPITools/Model/Capitalization.cs | 71 +- .../src/Org.OpenAPITools/Model/Cat.cs | 39 +- .../src/Org.OpenAPITools/Model/Category.cs | 50 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 30 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 16 +- .../Model/ComplexQuadrilateral.cs | 27 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 13 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 16 +- .../Model/DeprecatedObject.cs | 16 +- .../src/Org.OpenAPITools/Model/Dog.cs | 45 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 68 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 34 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 470 ++-- .../Model/EquilateralTriangle.cs | 27 +- .../src/Org.OpenAPITools/Model/File.cs | 16 +- .../Model/FileSchemaTestClass.cs | 38 +- .../src/Org.OpenAPITools/Model/Foo.cs | 16 +- .../Model/FooGetDefaultResponse.cs | 22 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 359 ++- .../src/Org.OpenAPITools/Model/Fruit.cs | 20 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 23 +- .../Model/GrandparentAnimal.cs | 13 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 27 +- .../Model/HealthCheckResult.cs | 8 +- .../Model/IsoscelesTriangle.cs | 27 +- .../src/Org.OpenAPITools/Model/List.cs | 16 +- .../Model/LiteralStringClass.cs | 27 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 17 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 70 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 59 +- .../Model/Model200Response.cs | 27 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 16 +- .../src/Org.OpenAPITools/Model/Name.cs | 50 +- ...cationtestGetElementsV1ResponseMPayload.cs | 27 +- .../Org.OpenAPITools/Model/NullableClass.cs | 158 +- .../Model/NullableGuidClass.cs | 9 +- .../Org.OpenAPITools/Model/NullableShape.cs | 15 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 16 +- .../Model/ObjectWithDeprecatedFields.cs | 60 +- .../src/Org.OpenAPITools/Model/Order.cs | 74 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 38 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 13 +- .../src/Org.OpenAPITools/Model/Pet.cs | 131 +- .../src/Org.OpenAPITools/Model/Pig.cs | 15 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 15 +- .../Model/QuadrilateralInterface.cs | 13 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 27 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2241 +++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 16 +- .../Model/RolesReportsHash.cs | 34 +- .../Model/RolesReportsHashRole.cs | 16 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 27 +- .../src/Org.OpenAPITools/Model/Shape.cs | 15 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 13 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 15 +- .../Model/SimpleQuadrilateral.cs | 27 +- .../Model/SpecialModelName.cs | 27 +- .../src/Org.OpenAPITools/Model/Tag.cs | 27 +- .../Model/TestCollectionEndingWithWordList.cs | 16 +- .../TestCollectionEndingWithWordListObject.cs | 22 +- ...lineFreeformAdditionalPropertiesRequest.cs | 16 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 17 +- .../Model/TriangleInterface.cs | 13 +- .../src/Org.OpenAPITools/Model/User.cs | 156 +- .../src/Org.OpenAPITools/Model/Whale.cs | 39 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 31 +- .../Model/ZeroBasedEnumClass.cs | 19 +- 102 files changed, 5530 insertions(+), 1235 deletions(-) create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java create mode 100644 modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java create mode 100644 modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache create mode 100644 modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index e9a7a50b8a09..4d2e919b1a7f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -411,6 +411,9 @@ public void execute(Template.Fragment fragment, Writer writer) throws IOExceptio @Override protected ImmutableMap.Builder addMustacheLambdas() { + CopyLambda copyLambda = new CopyLambda(); + CopyLambda copyLambda2 = new CopyLambda(); + return super.addMustacheLambdas() .put("camelcase_param", new CamelCaseLambda().generator(this).escapeAsParamName(true)) .put("required", new RequiredParameterLambda()) @@ -423,9 +426,18 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("trimTrailing", new TrimTrailingWhiteSpaceLambda(false)) .put("first", new FirstLambda(" ")) .put("firstDot", new FirstLambda("\\.")) + .put("indent1", new IndentedLambda(4, " ", false, true)) .put("indent3", new IndentedLambda(12, " ", false, true)) .put("indent4", new IndentedLambda(16, " ", false, true)) - .put("uniqueLinesWithNewLine", new UniqueLambda("\n", true)); + .put("indentLine1", new IndentedLambda(4, " ", true, true)) + .put("indentLine3", new IndentedLambda(12, " ", true, true)) + .put("indentLine4", new IndentedLambda(16, " ", true, true)) + // .put("uniqueLinesWithNewLine", new UniqueLambda("\n", true)) + .put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda(true)) + .put("copy", copyLambda) + .put("copy2", copyLambda2) + .put("pasteLine", new PasteLambda(copyLambda, true, true, false)) + .put("pasteLine2", new PasteLambda(copyLambda2, true, true, false)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index bb27fe20f646..a5a6d7f44ae3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -454,7 +454,7 @@ public CodegenModel fromModel(String name, Schema model) { Collections.sort(codegenModel.readWriteVars, propertyComparatorByName); Collections.sort(codegenModel.parentVars, propertyComparatorByName); - Comparator comparator = propertyComparatorByNullable.thenComparing(propertyComparatorByDefaultValue); + Comparator comparator = propertyComparatorByNullable.thenComparing(propertyComparatorByRequired).thenComparing(propertyComparatorByDefaultValue); Collections.sort(codegenModel.vars, comparator); Collections.sort(codegenModel.allVars, comparator); Collections.sort(codegenModel.requiredVars, comparator); @@ -486,6 +486,18 @@ else if (one.defaultValue == null) } }; + public static Comparator propertyComparatorByRequired = new Comparator() { + @Override + public int compare(CodegenProperty one, CodegenProperty another) { + if (one.required == another.required) + return 0; + else if (Boolean.TRUE.equals(one.required)) + return -1; + else + return 1; + } + }; + public static Comparator propertyComparatorByNullable = new Comparator() { @Override public int compare(CodegenProperty one, CodegenProperty another) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java new file mode 100644 index 000000000000..f3e5fe8138a5 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java @@ -0,0 +1,48 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.templating.mustache; + +import java.io.IOException; +import java.io.Writer; + +import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template.Fragment; + +/** + * Saves template text to be used later. + * + * Register: + *
+ * additionalProperties.put("save", new SaveLambda());
+ * 
+ * + * Use: + *
+ * {{#save}}{{name}}{{/save}}
+ * 
+ */ +public class CopyLambda implements Mustache.Lambda { + public String savedContent; + + public CopyLambda() { + } + + @Override + public void execute(Fragment fragment, Writer writer) throws IOException { + savedContent = fragment.execute().stripTrailing(); + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java new file mode 100644 index 000000000000..43c8bf226114 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java @@ -0,0 +1,66 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.templating.mustache; + +import java.io.IOException; +import java.io.Writer; + +import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template.Fragment; + +/** + * Writes text that was previously saved. + * + * Register: + *
+ * additionalProperties.put("write", new WriteLambda());
+ * 
+ * + * Use: + *
+ * {{#write}}{{name}}{{/write}}
+ * 
+ */ +public class PasteLambda implements Mustache.Lambda { + private final CopyLambda copyLambda; + private final Boolean stripLeading; + private final Boolean stripTrailing; + private final Boolean endWithLineBreak; + + public PasteLambda(CopyLambda copyLambda, Boolean stripLeading, Boolean stripTrailing, Boolean endWithLineBreak) { + this.copyLambda = copyLambda; + this.stripLeading = stripLeading; + this.stripTrailing = stripTrailing; + this.endWithLineBreak = endWithLineBreak; + } + + @Override + public void execute(Fragment fragment, Writer writer) throws IOException { + String content = this.copyLambda.savedContent; + + if (this.stripTrailing){ + content = content.stripTrailing(); + } + if (this.stripLeading) { + content = content.stripLeading(); + } + if (this.endWithLineBreak && !content.endsWith("\n")){ + content = content + "\n"; + } + writer.write(content); + } +} 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 33bcf3226d60..f001815161fe 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 @@ -38,7 +38,7 @@ JsonTokenType startingTokenType = utf8JsonReader.TokenType; {{#allVars}} - {{^required}}Option<{{/required}}{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; + Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}> {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; {{#-last}} {{/-last}} @@ -117,7 +117,7 @@ {{#anyOf}} {{^vendorExtensions.x-duplicated-data-type}} - {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; + {{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = default; {{#-last}} Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; @@ -167,39 +167,39 @@ {{^isMap}} {{^isEnum}} {{^isUuid}} - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetString(){{^nullable}}{{nrt!}}{{/nullable}}{{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetString(){{^isNullable}}{{nrt!}}{{/isNullable}}); {{/isUuid}} {{/isEnum}} {{/isMap}} {{/isString}} {{#isBoolean}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetBoolean(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetBoolean()); {{/isBoolean}} {{#isNumeric}} {{^isEnum}} {{#isDouble}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDouble(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDouble()); {{/isDouble}} {{#isDecimal}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDecimal(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetDecimal()); {{/isDecimal}} {{#isFloat}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}(float)utf8JsonReader.GetDouble(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}(float)utf8JsonReader.GetDouble()); {{/isFloat}} {{#isLong}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int64()); {{/isLong}} {{^isLong}} {{^isFloat}} {{^isDecimal}} {{^isDouble}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); {{/isDouble}} {{/isDecimal}} {{/isFloat}} @@ -208,36 +208,34 @@ {{/isNumeric}} {{#isDate}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); {{/isDate}} {{#isDateTime}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); {{/isDateTime}} {{#isEnum}} {{^isMap}} {{#isNumeric}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}({{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}})utf8JsonReader.Get{{#vendorExtensions.x-unsigned}}U{{/vendorExtensions.x-unsigned}}Int32()); {{/isNumeric}} {{^isNumeric}} string{{nrt?}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = utf8JsonReader.GetString(); {{^isInnerEnum}} - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue == null - ? null - : {{>OptionProperty}}{{{datatypeWithEnum}}}ValueConverter.FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue){{^required}}){{/required}}; + if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}{{{datatypeWithEnum}}}ValueConverter.FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue)); {{/isInnerEnum}} {{#isInnerEnum}} - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue == null - ? null - : {{>OptionProperty}}{{classname}}.{{{datatypeWithEnum}}}FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue){{^required}}){{/required}}; + if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}{{classname}}.{{{datatypeWithEnum}}}FromStringOrDefault({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue)); {{/isInnerEnum}} {{/isNumeric}} {{/isMap}} {{/isEnum}} {{#isUuid}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetGuid(){{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}utf8JsonReader.GetGuid()); {{/isUuid}} {{^isUuid}} {{^isEnum}} @@ -247,7 +245,7 @@ {{^isDate}} {{^isDateTime}} if (utf8JsonReader.TokenType != JsonTokenType.Null) - {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^nullable}}{{nrt!}}{{/nullable}}{{^required}}){{/required}}; + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} = {{>OptionProperty}}JsonSerializer.Deserialize<{{{datatypeWithEnum}}}>(ref utf8JsonReader, jsonSerializerOptions){{^isNullable}}{{nrt!}}{{/isNullable}}); {{/isDateTime}} {{/isDate}} {{/isNumeric}} @@ -265,17 +263,37 @@ {{#allVars}} {{#required}} - if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} == null) + if (!{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.IsSet) throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}), "Property is required for class {{classname}}."); {{/required}} {{/allVars}} + {{#allVars}} + {{^isNullable}} + if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value == null) + throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}), "Property is not nullable for class {{classname}}."); + + {{/isNullable}} + {{/allVars}} + {{#allVars}} + {{#required}} + {{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}}; + {{/required}} + {{^required}} + {{^isNullable}} + Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}> {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}>({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}); + {{/isNullable}} + {{/required}} + {{#-last}} + + {{/-last}} + {{/allVars}} {{^vendorExtensions.x-duplicated-data-type}} {{#model.discriminator}} {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{#-last}} throw new JsonException(); @@ -284,13 +302,21 @@ {{/model.hasDiscriminatorWithNonEmptyMapping}} {{/model.discriminator}} {{^composedSchemas.oneOf}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/allVars}}{{/lambda.joinWithComma}}); + {{^required}} + {{#model.composedSchemas.anyOf}} + Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); + {{/model.composedSchemas.anyOf}} + {{#-last}} + + {{/-last}} + {{/required}} + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} {{#oneOf}} if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{#-last}} throw new JsonException(); @@ -358,74 +384,63 @@ {{^isMap}} {{^isEnum}} {{^isUuid}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); + {{#lambda.copy}} + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isUuid}} {{/isEnum}} {{/isMap}} {{/isString}} {{#isBoolean}} - {{#isNullable}} - - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); - else - writer.WriteNull("{{baseName}}"); - - {{/isNullable}} - {{^isNullable}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); - {{/isNullable}} + {{#lambda.copy}} + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isBoolean}} {{^isEnum}} {{#isNumeric}} - {{#isNullable}} - - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); - else - writer.WriteNull("{{baseName}}"); - - {{/isNullable}} - {{^isNullable}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); - {{/isNullable}} + {{#lambda.copy}} + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isNumeric}} {{/isEnum}} {{#isDate}} - {{#isNullable}} - - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value.ToString({{name}}Format)); - else - writer.WriteNull("{{baseName}}"); - - {{/isNullable}} - {{^isNullable}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.ToString({{name}}Format)); - {{/isNullable}} + {{#lambda.copy}} + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isDate}} {{#isDateTime}} - {{#isNullable}} - - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value.ToString({{name}}Format)); - else - writer.WriteNull("{{baseName}}"); - - {{/isNullable}} - {{^isNullable}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.ToString({{name}}Format)); - {{/isNullable}} + {{#lambda.copy}} + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isDateTime}} {{#isEnum}} {{#isNumeric}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}})); + {{#lambda.copy}} + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}})); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isNumeric}} {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -433,8 +448,11 @@ {{/isInnerEnum}} {{^isInnerEnum}} + {{#lambda.copy}} + {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue + {{/lambda.copy}} + {{#required}} {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) writer.WriteNull("{{baseName}}"); else @@ -444,7 +462,7 @@ {{#enumVars}} {{#-first}} {{#isString}} - if ({{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue != null){{! we cant use name here because enumVar also has a name property, so use the camel case variant only as a work around }} + if ({{#lambda.pasteLine}}{{/lambda.pasteLine}} != null){{! we cant use name here because enumVar also has a name property, so use the paste lambda instead }} writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue); else writer.WriteNull("{{baseName}}"); @@ -456,44 +474,54 @@ {{/enumVars}} {{/allowableValues}} } - {{/isNullable}} {{^isNullable}} - var {{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); {{#allowableValues}} {{#enumVars}} {{#-first}} {{#isString}} - - if ({{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue != null) - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue); - else - writer.WriteNull("{{baseName}}"); - + writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); {{/isString}} {{^isString}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{nameInCamelCase}}{{/lambda.camelcase_param}}RawValue); + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/lambda.camelcase_param}}RawValue); {{/isString}} {{/-first}} {{/enumVars}} {{/allowableValues}} {{/isNullable}} + + {{/required}} + {{^required}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) + {{#isNullable}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + { + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value.Value); + writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); + } + else + writer.WriteNull("{{baseName}}"); + {{/isNullable}} + {{^isNullable}} + { + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); + writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); + } + {{/isNullable}} + {{/required}} {{/isInnerEnum}} {{/isNumeric}} {{/isMap}} {{/isEnum}} {{#isUuid}} - {{^isNullable}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); - {{/isNullable}} - {{#isNullable}} - - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) - writer.WriteNull("{{baseName}}"); - else - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); - {{/isNullable}} + {{#lambda.copy}} + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); + {{/lambda.copy}} + {{#lambda.indent3}} + {{>WriteProperty}} + {{/lambda.indent3}} {{/isUuid}} {{^isUuid}} {{^isEnum}} @@ -502,8 +530,43 @@ {{^isNumeric}} {{^isDate}} {{^isDateTime}} + + + + + // hello world! + + {{#required}} + {{#isNullable}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + { + writer.WritePropertyName("{{baseName}}"); + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + } + else + writer.WriteNull("{{baseName}}"); + {{/isNullable}} + {{^isNullable}} writer.WritePropertyName("{{baseName}}"); JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + {{/isNullable}} + {{/required}} + {{^required}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) + {{#isNullable}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + { + writer.WritePropertyName("{{baseName}}"); + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + } + else + writer.WriteNull("{{baseName}}"); + {{/isNullable}} + {{^isNullable}} + writer.WritePropertyName("{{baseName}}"); + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + {{/isNullable}} + {{/required}} {{/isDateTime}} {{/isDate}} {{/isNumeric}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelBaseSignature.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelBaseSignature.mustache index 3a1e7c35d69c..b5a2c08ac29c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelBaseSignature.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelBaseSignature.mustache @@ -1 +1 @@ -{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/allVars}} \ No newline at end of file +{{#parentModel.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{#isArray}}{{{dataFormat}}}{{/isArray}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.anyOf}}{{#allVars}}{{#isInherited}}{{^isNew}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{/isNew}}{{#isNew}}{{#isEnum}}{{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{^required}}.Value{{/required}}){{/isEnum}}{{^isEnum}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.ToString(){{/isEnum}}{{/isNew}} {{/isInherited}}{{/allVars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache index 80da5edd915c..faa8273bf2bd 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ModelSignature.mustache @@ -1 +1 @@ -{{#model.allVars}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{defaultValue}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/defaultValue}}{{^defaultValue}}{{#isNullable}} = default{{/isNullable}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file +{{#model.allVars}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#defaultValue}} = {{^required}}default{{/required}}{{#required}}{{^isDateTime}}{{#isString}}{{^isEnum}}@{{/isEnum}}{{/isString}}{{{.}}}{{/isDateTime}}{{#isDateTime}}default{{/isDateTime}}{{/required}}{{/defaultValue}}{{^defaultValue}}{{#lambda.first}}{{#isNullable}} = default {{/isNullable}}{{^required}} = default {{/required}}{{/lambda.first}}{{/defaultValue}} {{/model.allVars}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache index c6a7d58779cd..d7504188775e 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/OptionProperty.mustache @@ -1 +1 @@ -{{^required}}new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>({{/required}} \ No newline at end of file +new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}>( \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache new file mode 100644 index 000000000000..673f988d1a53 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache @@ -0,0 +1,9 @@ +{{#required}} +{{>WritePropertyHelper}} +{{/required}} +{{^required}} +if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) + {{#lambda.indent1}} + {{>WritePropertyHelper}} + {{/lambda.indent1}} +{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache new file mode 100644 index 000000000000..2b38a39edb47 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache @@ -0,0 +1,9 @@ +{{#isNullable}} +if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + {{#lambda.pasteLine}}{{/lambda.pasteLine}} +else + writer.WriteNull("{{baseName}}"); +{{/isNullable}} +{{^isNullable}} +{{#lambda.pasteLine}}{{/lambda.pasteLine}} +{{/isNullable}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache index e2b628ebe5ae..786452d4b6d4 100644 --- a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache @@ -74,12 +74,16 @@ {{#isString}} /// {{/isString}} - public static {{>EnumValueDataType}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} value) + public static {{>EnumValueDataType}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} value) { {{^isString}} return ({{>EnumValueDataType}}) value; {{/isString}} {{#isString}} + {{#isNullable}} + if (value == null) + return null; + {{/isNullable}} {{#allowableValues}} {{#enumVars}} if (value == {{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}.{{name}}) diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 2fab0cbf5941..0dc312b891ec 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -1983,6 +1983,268 @@ components: nullable: true type: string description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + RequiredClass: + type: object + properties: + required_nullable_integer_prop: + type: integer + nullable: true + required_notnullableinteger_prop: + type: integer + nullable: false + not_required_nullable_integer_prop: + type: integer + nullable: true + not_required_notnullableinteger_prop: + type: integer + nullable: false + + required_nullable_string_prop: + type: string + nullable: true + required_notnullable_string_prop: + type: string + nullable: false + notrequired_nullable_string_prop: + type: string + nullable: true + notrequired_notnullable_string_prop: + type: string + nullable: false + + required_nullable_boolean_prop: + type: boolean + nullable: true + required_notnullable_boolean_prop: + type: boolean + nullable: false + notrequired_nullable_boolean_prop: + type: boolean + nullable: true + notrequired_notnullable_boolean_prop: + type: boolean + nullable: false + + required_nullable_date_prop: + type: string + format: date + nullable: true + required_not_nullable_date_prop: + type: string + format: date + nullable: false + not_required_nullable_date_prop: + type: string + format: date + nullable: true + not_required_notnullable_date_prop: + type: string + format: date + nullable: false + + required_notnullable_datetime_prop: + type: string + format: date-time + nullable: false + required_nullable_datetime_prop: + type: string + format: date-time + nullable: true + notrequired_nullable_datetime_prop: + type: string + format: date-time + nullable: true + notrequired_notnullable_datetime_prop: + type: string + format: date-time + nullable: false + + required_nullable_enum_integer: + type: integer + format: int32 + nullable: true + enum: + - 1 + - -1 + required_notnullable_enum_integer: + type: integer + format: int32 + nullable: false + enum: + - 1 + - -1 + notrequired_nullable_enum_integer: + type: integer + format: int32 + nullable: true + enum: + - 1 + - -1 + notrequired_notnullable_enum_integer: + type: integer + format: int32 + nullable: false + enum: + - 1 + - -1 + + + + required_nullable_enum_integer_only: + type: integer + nullable: true + enum: + - 2 + - -2 + required_notnullable_enum_integer_only: + type: integer + nullable: false + enum: + - 2 + - -2 + notrequired_nullable_enum_integer_only: + type: integer + nullable: true + enum: + - 2 + - -2 + notrequired_notnullable_enum_integer_only: + type: integer + nullable: false + enum: + - 2 + - -2 + + required_notnullable_enum_string: + type: string + nullable: false + enum: + - UPPER + - lower + - '' + - "Value\twith tab" + - 'Value with " quote' + - 'Value with escaped \" quote' + - "Duplicate\nvalue" + - "Duplicate\r\nvalue" + required_nullable_enum_string: + type: string + nullable: true + enum: + - UPPER + - lower + - '' + - "Value\twith tab" + - 'Value with " quote' + - 'Value with escaped \" quote' + - "Duplicate\nvalue" + - "Duplicate\r\nvalue" + notrequired_nullable_enum_string: + type: string + nullable: true + enum: + - UPPER + - lower + - '' + - "Value\twith tab" + - 'Value with " quote' + - 'Value with escaped \" quote' + - "Duplicate\nvalue" + - "Duplicate\r\nvalue" + notrequired_notnullable_enum_string: + type: string + nullable: false + enum: + - UPPER + - lower + - '' + - "Value\twith tab" + - 'Value with " quote' + - 'Value with escaped \" quote' + - "Duplicate\nvalue" + - "Duplicate\r\nvalue" + + required_nullable_outerEnumDefaultValue: + nullable: true + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + required_notnullable_outerEnumDefaultValue: + nullable: false + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + notrequired_nullable_outerEnumDefaultValue: + nullable: true + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + notrequired_notnullable_outerEnumDefaultValue: + nullable: false + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + + required_nullable_uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + nullable: true + required_notnullable_uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + nullable: false + notrequired_nullable_uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + nullable: true + notrequired_notnullable_uuid: + type: string + format: uuid + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + nullable: false + + required_nullable_array_of_string: + type: array + nullable: true + items: + type: string + required_notnullable_array_of_string: + type: array + nullable: false + items: + type: string + notrequired_nullable_array_of_string: + type: array + nullable: true + items: + type: string + notrequired_notnullable_array_of_string: + type: array + nullable: false + items: + type: string + required: + - required_nullable_boolean_prop + - required_notnullable_boolean_prop + - required_nullable_string_prop + - required_notnullable_string_prop + - required_nullable_integer_prop + - required_notnullableinteger_prop + - required_nullable_date_prop + - required_not_nullable_date_prop + - required_notnullable_datetime_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_notnullable_enum_integer + - required_nullable_enum_integer_only + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_nullable_enum_string + - required_nullable_outerEnumDefaultValue + - required_notnullable_outerEnumDefaultValue + - required_nullable_uuid + - required_notnullable_uuid + - required_nullable_array_of_string + - required_notnullable_array_of_string NullableClass: type: object properties: diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..69ed03711e55 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,74 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'BooleanProp' + /// + [Fact] + public void BooleanPropTest() + { + // TODO unit test for the property 'BooleanProp' + } + + /// + /// Test the property 'NullableBooleanProp' + /// + [Fact] + public void NullableBooleanPropTest() + { + // TODO unit test for the property 'NullableBooleanProp' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index e4ccc2b4d239..6760996e26bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -141,6 +141,8 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -149,8 +151,6 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,6 +167,30 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs index 968417a9e748..a26741d84b71 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -116,6 +116,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index f48753ed0719..02060469b79b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -36,7 +36,7 @@ public partial class Activity : IValidatableObject ///
/// activityOutputs [JsonConstructor] - public Activity(Option>> activityOutputs) + public Activity(Option>> activityOutputs = default) { ActivityOutputs = activityOutputs; OnCreated(); @@ -103,7 +103,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> activityOutputs = default; + Option>?> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { 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; @@ -130,7 +130,12 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - return new Activity(activityOutputs); + if (activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + + Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); + + return new Activity(activityOutputsParsedValue); } /// @@ -157,8 +162,13 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + + + // hello world! + + if (activity.ActivityOutputs.IsSet) + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 9fc9cb7ee243..33100692726d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -37,7 +37,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(Option prop1, Option prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { Prop1 = prop1; Prop2 = prop2; @@ -112,8 +112,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option prop1 = default; - Option prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -131,11 +131,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = new Option(utf8JsonReader.GetString()!); + 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; @@ -143,7 +143,16 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - return new ActivityOutputElementRepresentation(prop1, prop2); + if (prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + + if (prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + + Option prop1ParsedValue = new Option(prop1.Value); + Option prop2ParsedValue = new Option(prop2.Value); + + return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); } /// @@ -170,9 +179,15 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); + + + // hello world! + + if (activityOutputElementRepresentation.Prop2.IsSet) + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index c928bac3f7e5..4db1d574121b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -43,7 +43,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap, Option>> mapOfMapProperty, Option> mapProperty, Option mapWithUndeclaredPropertiesAnytype1, Option mapWithUndeclaredPropertiesAnytype2, Option> mapWithUndeclaredPropertiesAnytype3, Option> mapWithUndeclaredPropertiesString, Option anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -167,13 +167,13 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option emptyMap = default; - Option>> mapOfMapProperty = default; - Option> mapProperty = default; - Option mapWithUndeclaredPropertiesAnytype1 = default; - Option mapWithUndeclaredPropertiesAnytype2 = default; - Option> mapWithUndeclaredPropertiesAnytype3 = default; - Option> mapWithUndeclaredPropertiesString = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; Option anytype1 = default; while (utf8JsonReader.Read()) @@ -193,35 +193,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { 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; 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; default: break; @@ -229,7 +229,36 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + if (emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + + if (mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + + Option emptyMapParsedValue = new Option(emptyMap.Value); + Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); + Option> mapPropertyParsedValue = new Option>(mapProperty.Value); + Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); + Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); + Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); + Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); + + return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); } /// @@ -256,22 +285,60 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + + + // hello world! + + if (additionalPropertiesClass.EmptyMap.IsSet) + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapOfMapProperty.IsSet) + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapProperty.IsSet) + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + + // hello world! + + if (additionalPropertiesClass.Anytype1.IsSet) + if (additionalPropertiesClass.Anytype1.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 38056119e036..301eff4963a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -37,7 +37,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, Option color = @"red") + public Animal(string className, Option color = default) { ClassName = className; Color = color; @@ -122,8 +122,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Option color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -141,10 +141,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -152,10 +152,19 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - return new Animal(className, color); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + string classNameParsedValue = className.Value; + Option colorParsedValue = new Option(color.Value); + + return new Animal(classNameParsedValue, colorParsedValue); } /// @@ -182,8 +191,9 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + writer.WriteString("className", animal.ClassName); + if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index 1395de921320..e203a8c21ed1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -38,7 +38,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(Option code, Option message, Option type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { Code = code; Message = message; @@ -121,9 +121,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option code = default; - Option message = default; - Option type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -142,13 +142,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = new Option(utf8JsonReader.GetString()!); + message = new Option(utf8JsonReader.GetString()!); break; case "type": - type = new Option(utf8JsonReader.GetString()!); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -156,7 +156,20 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - return new ApiResponse(code.Value, message, type); + if (code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + + if (message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + + Option codeParsedValue = new Option(code.Value.Value); + Option messageParsedValue = new Option(message.Value); + Option typeParsedValue = new Option(type.Value); + + return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); } /// @@ -183,9 +196,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); + if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); + if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index c1e35ffd5f9c..47c5822c6b19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -38,7 +38,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(Option colorCode, Option cultivar, Option origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { ColorCode = colorCode; Cultivar = cultivar; @@ -97,7 +97,7 @@ public override string ToString() { if (this.ColorCode != null) { // ColorCode (string) pattern - Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); // a if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); @@ -106,7 +106,7 @@ public override string ToString() if (this.Cultivar != null) { // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); // a if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); @@ -115,7 +115,7 @@ public override string ToString() if (this.Origin != null) { // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); @@ -148,9 +148,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option colorCode = default; - Option cultivar = default; - Option origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -168,13 +168,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = new Option(utf8JsonReader.GetString()!); + colorCode = new Option(utf8JsonReader.GetString()!); break; case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()!); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "origin": - origin = new Option(utf8JsonReader.GetString()!); + origin = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -182,7 +182,20 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - return new Apple(colorCode, cultivar, origin); + if (colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + + if (origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + + Option colorCodeParsedValue = new Option(colorCode.Value); + Option cultivarParsedValue = new Option(cultivar.Value); + Option originParsedValue = new Option(origin.Value); + + return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); } /// @@ -209,9 +222,12 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); + if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); + if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index e190014b4a19..82243cc33393 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -37,7 +37,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, Option mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; Mealy = mealy; @@ -105,8 +105,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string cultivar = default; - Option mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -124,11 +124,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString()!; + cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -136,10 +136,19 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) + if (!cultivar.IsSet) throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + + if (mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + string cultivarParsedValue = cultivar.Value; + Option mealyParsedValue = new Option(mealy.Value.Value); + + return new AppleReq(cultivarParsedValue, mealyParsedValue); } /// @@ -166,8 +175,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + writer.WriteString("cultivar", appleReq.Cultivar); + if (appleReq.Mealy.IsSet) + writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index abae0ad9fcc7..c3fdbde7e5ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -36,7 +36,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -103,7 +103,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayNumber = default; + Option>?> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { 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; @@ -130,7 +130,12 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + if (arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + + Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); } /// @@ -157,8 +162,13 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + + + // hello world! + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 9474e34f4246..41e7be6c9681 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -36,7 +36,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(Option> arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { ArrayNumber = arrayNumber; OnCreated(); @@ -103,7 +103,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayNumber = default; + Option?> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { 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; @@ -130,7 +130,12 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new ArrayOfNumberOnly(arrayNumber); + if (arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + + Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); + + return new ArrayOfNumberOnly(arrayNumberParsedValue); } /// @@ -157,8 +162,13 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + + + // hello world! + + if (arrayOfNumberOnly.ArrayNumber.IsSet) + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 03df0c48f345..75f8bc53bdd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -38,7 +38,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(Option>> arrayArrayOfInteger, Option>> arrayArrayOfModel, Option> arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -121,9 +121,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayOfInteger = default; - Option>> arrayArrayOfModel = default; - Option> arrayOfString = default; + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -142,15 +142,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { 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; @@ -158,7 +158,20 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + if (arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + + if (arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + + if (arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + + Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); + Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); + Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); + + return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); } /// @@ -185,12 +198,25 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + + + // hello world! + + if (arrayTest.ArrayArrayOfInteger.IsSet) + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + + // hello world! + + if (arrayTest.ArrayArrayOfModel.IsSet) + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + + // hello world! + + if (arrayTest.ArrayOfString.IsSet) + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index 0fb247cc7007..3f1ac483677c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -36,7 +36,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(Option lengthCm) + public Banana(Option lengthCm = default) { LengthCm = lengthCm; OnCreated(); @@ -103,7 +103,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -130,7 +130,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - return new Banana(lengthCm.Value); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + + Option lengthCmParsedValue = new Option(lengthCm.Value.Value); + + return new Banana(lengthCmParsedValue); } /// @@ -157,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCm.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCm.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index f2378cd20c18..4e251b432925 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -37,7 +37,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, Option sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; Sweet = sweet; @@ -105,8 +105,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal lengthCm = default; - Option sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -125,11 +125,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -137,10 +137,19 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) + if (!lengthCm.IsSet) throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + + if (sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + decimal lengthCmParsedValue = lengthCm.Value.Value; + Option sweetParsedValue = new Option(sweet.Value.Value); + + return new BananaReq(lengthCmParsedValue, sweetParsedValue); } /// @@ -167,8 +176,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + if (bananaReq.Sweet.IsSet) + writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index aeccef64f967..2de32b6365ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -103,7 +103,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +129,15 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - return new BasquePig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + string classNameParsedValue = className.Value; + + return new BasquePig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 13eb885c1fb6..4279fdfdaeab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -41,7 +41,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(Option aTTNAME, Option capitalCamel, Option capitalSnake, Option sCAETHFlowPoints, Option smallCamel, Option smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -149,12 +149,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option aTTNAME = default; - Option capitalCamel = default; - Option capitalSnake = default; - Option sCAETHFlowPoints = default; - Option smallCamel = default; - Option smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -172,22 +172,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = new Option(utf8JsonReader.GetString()!); + aTTNAME = new Option(utf8JsonReader.GetString()!); break; case "CapitalCamel": - capitalCamel = new Option(utf8JsonReader.GetString()!); + capitalCamel = new Option(utf8JsonReader.GetString()!); break; case "Capital_Snake": - capitalSnake = new Option(utf8JsonReader.GetString()!); + capitalSnake = new Option(utf8JsonReader.GetString()!); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); break; case "smallCamel": - smallCamel = new Option(utf8JsonReader.GetString()!); + smallCamel = new Option(utf8JsonReader.GetString()!); break; case "small_Snake": - smallSnake = new Option(utf8JsonReader.GetString()!); + smallSnake = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,7 +195,32 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + if (aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + + if (capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + + if (capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + + if (sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + + if (smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + + if (smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + + Option aTTNAMEParsedValue = new Option(aTTNAME.Value); + Option capitalCamelParsedValue = new Option(capitalCamel.Value); + Option capitalSnakeParsedValue = new Option(capitalSnake.Value); + Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); + Option smallCamelParsedValue = new Option(smallCamel.Value); + Option smallSnakeParsedValue = new Option(smallSnake.Value); + + return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); } /// @@ -222,12 +247,18 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); + if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); + if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); + if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); + if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); + if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index c066b2425c7e..73d0e6a2b804 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -38,7 +38,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, Option declawed, Option color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { Declawed = declawed; OnCreated(); @@ -89,9 +89,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Option declawed = default; - Option color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -109,14 +109,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -124,10 +124,23 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - return new Cat(className, declawed.Value, color); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + + if (declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + string classNameParsedValue = className.Value; + Option declawedParsedValue = new Option(declawed.Value.Value); + Option colorParsedValue = new Option(color.Value); + + return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); } /// @@ -154,9 +167,11 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + writer.WriteString("className", cat.ClassName); + if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); + if (cat.Color.IsSet) + writer.WriteString("color", cat.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 18ac3881d14a..24af32a1b017 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -34,30 +34,30 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(Option id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + Id = id; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Name /// [JsonPropertyName("name")] public string Name { get; set; } + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets additional properties /// @@ -72,8 +72,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -112,8 +112,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - string name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -130,12 +130,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); - break; - case "name": - name = utf8JsonReader.GetString()!; + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -143,10 +143,19 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - return new Category(id.Value, name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + string nameParsedValue = name.Value; + Option idParsedValue = new Option(id.Value.Value); + + return new Category(nameParsedValue, idParsedValue); } /// @@ -173,8 +182,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + writer.WriteString("name", category.Name); + if (category.Id.IsSet) + writer.WriteNumber("id", category.Id.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index 34e63898af12..c69ca489801e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -37,7 +37,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(Option name, Option petType = new Option(PetTypeEnum.ChildCat)) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { Name = name; PetType = petType; @@ -148,8 +148,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -167,13 +167,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = new Option(utf8JsonReader.GetString()!); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -181,7 +180,16 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - return new ChildCat(name, petType.Value); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); + + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + + Option nameParsedValue = new Option(name.Value); + Option petTypeParsedValue = new Option(petType.Value.Value); + + return new ChildCat(nameParsedValue, petTypeParsedValue); } /// @@ -208,9 +216,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); - - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 7c4e17371b86..8f8ef27d7cd4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -36,7 +36,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(Option varClass) + public ClassModel(Option varClass = default) { VarClass = varClass; OnCreated(); @@ -103,7 +103,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - return new ClassModel(varClass); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + + Option varClassParsedValue = new Option(varClass.Value); + + return new ClassModel(varClassParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClass.IsSet) + writer.WriteString("_class", classModel.VarClass.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index c56c40984ea3..80732f5e59e3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -112,8 +112,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -131,10 +131,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString()!; + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,13 +142,22 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -175,8 +184,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index 62de2a24e9cb..f22b5e7f65b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -103,7 +103,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +129,15 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - return new DanishPig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + string classNameParsedValue = className.Value; + + return new DanishPig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 927d4ad38f20..e4a94d4e6e21 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -36,7 +36,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(Option dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -109,7 +109,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -128,7 +128,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { 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; @@ -136,7 +136,12 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - return new DateOnlyClass(dateOnlyProperty.Value); + if (dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + + Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); + + return new DateOnlyClass(dateOnlyPropertyParsedValue); } /// @@ -163,7 +168,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyProperty.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index fe43a737e6d4..2358e4779994 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -36,7 +36,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(Option name) + public DeprecatedObject(Option name = default) { Name = name; OnCreated(); @@ -103,7 +103,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - return new DeprecatedObject(name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + + Option nameParsedValue = new Option(name.Value); + + return new DeprecatedObject(nameParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.Name.IsSet) + writer.WriteString("name", deprecatedObject.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 6fa73d997969..5e77f63cda9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -34,11 +34,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(Option breed, string className, Option color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { Breed = breed; OnCreated(); @@ -89,9 +89,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option breed = default; - string className = default; - Option color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -108,14 +108,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = new Option(utf8JsonReader.GetString()!); - break; case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -123,10 +123,23 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - return new Dog(breed, className, color); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + string classNameParsedValue = className.Value; + Option breedParsedValue = new Option(breed.Value); + Option colorParsedValue = new Option(color.Value); + + return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); } /// @@ -153,9 +166,11 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + writer.WriteString("className", dog.ClassName); + if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); + if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 0822fec42f7e..d025f1ddb68e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -39,7 +39,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Option mainShape, Option> shapes, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -141,8 +141,8 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option mainShape = default; - Option> shapes = default; + Option mainShape = default; + Option?> shapes = default; Option nullableShape = default; Option shapeOrNull = default; @@ -163,19 +163,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { 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 "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = 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; default: break; @@ -183,7 +183,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + if (mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + + if (shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + + Option mainShapeParsedValue = new Option(mainShape.Value); + Option> shapesParsedValue = new Option>(shapes.Value); + + return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); } /// @@ -210,14 +219,41 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + + + // hello world! + + if (drawing.MainShape.IsSet) + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + + // hello world! + + if (drawing.Shapes.IsSet) + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + + // hello world! + + if (drawing.NullableShape.IsSet) + if (drawing.NullableShape.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + + // hello world! + + if (drawing.ShapeOrNull.IsSet) + if (drawing.ShapeOrNull.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index 0f0cd978b3e3..c6883f00029c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -37,7 +37,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(Option> arrayEnum, Option justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -244,8 +244,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayEnum = default; - Option justSymbol = default; + Option?> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -264,13 +264,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { 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(); - justSymbol = justSymbolRawValue == null - ? null - : new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -278,7 +277,16 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - return new EnumArrays(arrayEnum, justSymbol.Value); + if (arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); + + if (justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + + Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); + Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + + return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); } /// @@ -305,10 +313,14 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + + // hello world! + + if (enumArrays.ArrayEnum.IsSet) + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index ce3ce40cbf69..d43c11396a86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -34,23 +34,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(Option enumInteger, Option enumIntegerOnly, Option enumNumber, Option enumString, EnumStringRequiredEnum enumStringRequired, Option outerEnumDefaultValue, Option outerEnumInteger, Option outerEnumIntegerDefaultValue, Option outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { + EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; - EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -60,6 +60,162 @@ public EnumTest(Option enumInteger, Option partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// @@ -418,162 +574,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) [JsonPropertyName("enum_string")] public Option EnumString { get; set; } - /// - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Gets or Sets OuterEnumDefaultValue /// @@ -612,11 +612,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -659,14 +659,14 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option enumInteger = default; - Option enumIntegerOnly = default; - Option enumNumber = default; - Option enumString = default; - EnumTest.EnumStringRequiredEnum enumStringRequired = default; - Option outerEnumDefaultValue = default; - Option outerEnumInteger = default; - Option outerEnumIntegerDefaultValue = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; Option outerEnum = default; while (utf8JsonReader.Read()) @@ -684,53 +684,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + 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((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); - break; - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -738,10 +732,43 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumStringRequired == null) + if (!enumStringRequired.IsSet) throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + if (enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + + if (enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + + if (enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + + if (enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + + if (outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + + if (outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + + if (outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; + Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); + Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); + Option enumNumberParsedValue = new Option(enumNumber.Value.Value); + Option enumStringParsedValue = new Option(enumString.Value.Value); + Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); + Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); + Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); + + return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); } /// @@ -768,44 +795,47 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); + if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); + if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else - writer.WriteNull("outerEnumDefaultValue"); - - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + writer.WriteNull("enum_string"); - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); - else + if (enumTest.OuterEnumDefaultValue.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumInteger.IsSet) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteString("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValue.IsSet) + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteString("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnum.IsSet) + if (enumTest.OuterEnum.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 5f0ac3ed7641..0b058d0684f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -112,8 +112,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -131,10 +131,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString()!; + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,13 +142,22 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -175,8 +184,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index 5b2d5f7ad6c5..cbd4d00f0760 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -36,7 +36,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(Option sourceURI) + public File(Option sourceURI = default) { SourceURI = sourceURI; OnCreated(); @@ -104,7 +104,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = new Option(utf8JsonReader.GetString()!); + sourceURI = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,7 +130,12 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - return new File(sourceURI); + if (sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + + Option sourceURIParsedValue = new Option(sourceURI.Value); + + return new File(sourceURIParsedValue); } /// @@ -157,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURI.IsSet) + writer.WriteString("sourceURI", file.SourceURI.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 31abeac04212..ea5fcfca1efa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -37,7 +37,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(Option file, Option> files) + public FileSchemaTestClass(Option file = default, Option> files = default) { File = file; Files = files; @@ -112,8 +112,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option file = default; - Option> files = default; + Option file = default; + Option?> files = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { 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; @@ -144,7 +144,16 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - return new FileSchemaTestClass(file, files); + if (file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + + if (files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + + Option fileParsedValue = new Option(file.Value); + Option> filesParsedValue = new Option>(files.Value); + + return new FileSchemaTestClass(fileParsedValue, filesParsedValue); } /// @@ -171,10 +180,19 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + + + // hello world! + + if (fileSchemaTestClass.File.IsSet) + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + + // hello world! + + if (fileSchemaTestClass.Files.IsSet) + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index fa3c1cf8c55a..3607727a623d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -36,7 +36,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(Option bar = @"bar") + public Foo(Option bar = default) { Bar = bar; OnCreated(); @@ -103,7 +103,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - return new Foo(bar); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + + Option barParsedValue = new Option(bar.Value); + + return new Foo(barParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.Bar.IsSet) + writer.WriteString("bar", foo.Bar.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 15bac1f9d5b2..bbefb8d3fcf3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -36,7 +36,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Option varString) + public FooGetDefaultResponse(Option varString = default) { VarString = varString; OnCreated(); @@ -103,7 +103,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { 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; @@ -130,7 +130,12 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - return new FooGetDefaultResponse(varString); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + + Option varStringParsedValue = new Option(varString.Value); + + return new FooGetDefaultResponse(varStringParsedValue); } /// @@ -157,8 +162,13 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + + + // hello world! + + if (fooGetDefaultResponse.VarString.IsSet) + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index d1303e5362e9..122f0522b049 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -34,9 +34,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -44,8 +46,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -54,11 +54,13 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(Option binary, byte[] varByte, DateTime date, Option dateTime, Option varDecimal, Option varDouble, Option varFloat, Option int32, Option int64, Option integer, decimal number, string password, Option patternWithBackslash, Option patternWithDigits, Option patternWithDigitsAndDelimiter, Option varString, Option unsignedInteger, Option unsignedLong, Option uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; + Number = number; + Password = password; + Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -66,8 +68,6 @@ public FormatTest(Option binary, byte[] varByte, DateTime date Int32 = int32; Int64 = int64; Integer = integer; - Number = number; - Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -80,12 +80,6 @@ public FormatTest(Option binary, byte[] varByte, DateTime date partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public Option Binary { get; set; } - /// /// Gets or Sets VarByte /// @@ -99,6 +93,24 @@ public FormatTest(Option binary, byte[] varByte, DateTime date [JsonPropertyName("date")] public DateTime Date { get; set; } + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public Option Binary { get; set; } + /// /// Gets or Sets DateTime /// @@ -142,18 +154,6 @@ public FormatTest(Option binary, byte[] varByte, DateTime date [JsonPropertyName("integer")] public Option Integer { get; set; } - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } - /// /// None /// @@ -214,9 +214,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -224,8 +226,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -245,6 +245,30 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum if (this.VarDouble > (double)123.4) { @@ -293,33 +317,9 @@ public override string ToString() yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); // a if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); @@ -328,7 +328,7 @@ public override string ToString() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); // a if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); @@ -337,7 +337,7 @@ public override string ToString() if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); @@ -346,7 +346,7 @@ public override string ToString() if (this.VarString != null) { // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); @@ -401,25 +401,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option binary = default; - byte[] varByte = default; - DateTime date = default; - Option dateTime = default; - Option varDecimal = default; - Option varDouble = default; - Option varFloat = default; - Option int32 = default; - Option int64 = default; - Option integer = default; - decimal number = default; - string password = default; - Option patternWithBackslash = default; - Option patternWithDigits = default; - Option patternWithDigitsAndDelimiter = default; - Option varString = default; - Option unsignedInteger = default; - Option unsignedLong = default; - Option uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -436,76 +436,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!; + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString()!; + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = new Option(utf8JsonReader.GetString()!); + patternWithBackslash = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits": - patternWithDigits = new Option(utf8JsonReader.GetString()!); + patternWithDigits = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); break; case "string": - varString = new Option(utf8JsonReader.GetString()!); + varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -513,19 +513,96 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varByte == null) + if (!varByte.IsSet) throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (date == null) + if (!date.IsSet) throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (number == null) + if (!number.IsSet) throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (password == null) + if (!password.IsSet) throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + if (varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + + if (date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + + if (number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + + if (binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + + if (varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + + if (patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + + if (patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + byte[] varByteParsedValue = varByte.Value; + DateTime dateParsedValue = date.Value.Value; + decimal numberParsedValue = number.Value.Value; + string passwordParsedValue = password.Value; + Option binaryParsedValue = new Option(binary.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option varDecimalParsedValue = new Option(varDecimal.Value.Value); + Option varDoubleParsedValue = new Option(varDouble.Value.Value); + Option varFloatParsedValue = new Option(varFloat.Value.Value); + Option int32ParsedValue = new Option(int32.Value.Value); + Option int64ParsedValue = new Option(int64.Value.Value); + Option integerParsedValue = new Option(integer.Value.Value); + Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); + Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); + Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); + Option varStringParsedValue = new Option(varString.Value); + Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); + Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); + + return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); } /// @@ -552,28 +629,56 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + + + // hello world! + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + + + // hello world! + + if (formatTest.Binary.IsSet) + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); + + + // hello world! + + if (formatTest.VarDecimal.IsSet) + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); + if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); + if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); + if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); + if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); + if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); + if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); + if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); + if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); + if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); + if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); + + if (formatTest.Uuid.IsSet) + writer.WriteString("uuid", formatTest.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index dd6b996755c0..797aa4ea71bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -36,7 +36,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color) + public Fruit(Apple apple, Option color = default) { Apple = apple; Color = color; @@ -48,7 +48,7 @@ public Fruit(Apple apple, Option color) /// /// /// color - public Fruit(Banana banana, Option color) + public Fruit(Banana banana, Option color = default) { Banana = banana; Color = color; @@ -119,7 +119,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -159,7 +159,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -167,11 +167,16 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option colorParsedValue = new Option(color.Value); + if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, colorParsedValue); if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, colorParsedValue); throw new JsonException(); } @@ -200,7 +205,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 4cdcb67c2a85..b39989133a70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -37,7 +37,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Option apple, Option banana, Option color) + public GmFruit(Option apple, Option banana, Option color = default) { Apple = apple; Banana = banana; @@ -109,10 +109,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + Option color = default; - Option apple = default; - Option banana = default; + Apple? apple = default; + Banana? banana = default; Utf8JsonReader utf8JsonReaderAnyOf = utf8JsonReader; while (utf8JsonReaderAnyOf.Read()) @@ -149,7 +149,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -157,7 +157,15 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - return new GmFruit(apple, banana, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + + Option colorParsedValue = new Option(color.Value); + + Option appleParsedValue = new Option(apple); + Option bananaParsedValue = new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); } /// @@ -196,7 +204,8 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.Color.IsSet) + writer.WriteString("color", gmFruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index b7d770efc85f..6a72c0ffcb18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -113,7 +113,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -131,7 +131,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString()!; + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -139,10 +139,15 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - return new GrandparentAnimal(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + string petTypeParsedValue = petType.Value; + + return new GrandparentAnimal(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index a9653d3695a5..1396f23f7929 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -37,7 +37,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(Option bar, Option foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { Bar = bar; Foo = foo; @@ -149,8 +149,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -168,10 +168,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = new Option(utf8JsonReader.GetString()!); break; case "foo": - foo = new Option(utf8JsonReader.GetString()!); + foo = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -179,7 +179,16 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - return new HasOnlyReadOnly(bar, foo); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + + if (foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + + Option barParsedValue = new Option(bar.Value); + Option fooParsedValue = new Option(foo.Value); + + return new HasOnlyReadOnly(barParsedValue, fooParsedValue); } /// @@ -206,8 +215,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); + if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 5436159dac7c..01dce6e04e4a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -121,7 +121,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = new Option(utf8JsonReader.GetString()!); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -156,7 +156,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessage.IsSet) + if (healthCheckResult.NullableMessage.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f1bc144175a8..e57effbd4921 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -105,8 +105,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -124,10 +124,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString()!; + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -135,13 +135,22 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -168,8 +177,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index 1f4e6e63c40a..ebb73e8b280b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -36,7 +36,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(Option var123List) + public List(Option var123List = default) { Var123List = var123List; OnCreated(); @@ -103,7 +103,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = new Option(utf8JsonReader.GetString()!); + var123List = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - return new List(var123List); + if (var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + + Option var123ListParsedValue = new Option(var123List.Value); + + return new List(var123ListParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123List.IsSet) + writer.WriteString("123-list", list.Var123List.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index b6146717fb81..d73d542953af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -37,7 +37,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(Option escapedLiteralString = @"C:\\Users\\username", Option unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -112,8 +112,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option escapedLiteralString = default; - Option unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -131,10 +131,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = new Option(utf8JsonReader.GetString()!); + escapedLiteralString = new Option(utf8JsonReader.GetString()!); break; case "unescapedLiteralString": - unescapedLiteralString = new Option(utf8JsonReader.GetString()!); + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,7 +142,16 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + if (escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + if (unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + + Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); + Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); + + return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); } /// @@ -169,8 +178,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); + if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index dd35fe079925..72b585becee7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -153,7 +153,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; Pig? pig = null; Whale? whale = null; @@ -210,7 +210,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -218,17 +218,22 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + string classNameParsedValue = className.Value; + if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, classNameParsedValue); if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, classNameParsedValue); if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index 621519be0188..0c111fc625a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -39,7 +39,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Option> directMap, Option> indirectMap, Option>> mapMapOfString, Option> mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { DirectMap = directMap; IndirectMap = indirectMap; @@ -196,10 +196,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> directMap = default; - Option> indirectMap = default; - Option>> mapMapOfString = default; - Option> mapOfEnumString = default; + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -218,19 +218,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { 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; @@ -238,7 +238,24 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + if (directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); + + if (indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + + if (mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + + if (mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + + Option> directMapParsedValue = new Option>(directMap.Value); + Option> indirectMapParsedValue = new Option>(indirectMap.Value); + Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); + Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + + return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); } /// @@ -265,14 +282,31 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + + + // hello world! + + if (mapTest.DirectMap.IsSet) + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + + // hello world! + + if (mapTest.IndirectMap.IsSet) + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + + // hello world! + + if (mapTest.MapMapOfString.IsSet) + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + + // hello world! + + if (mapTest.MapOfEnumString.IsSet) + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 060bcc07d9ac..44a1389da4b4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -39,7 +39,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime, Option> map, Option uuid, Option uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { DateTime = dateTime; Map = map; @@ -105,7 +105,7 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); // a if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); @@ -141,10 +141,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateTime = default; - Option> map = default; - Option uuid = default; - Option uuidWithPattern = default; + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -163,19 +163,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { 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.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -183,7 +183,24 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option> mapParsedValue = new Option>(map.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); + Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); } /// @@ -210,11 +227,21 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); + + + // hello world! + + if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index fd618a1a9fc2..ecb61e131a62 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -37,7 +37,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(Option varClass, Option name) + public Model200Response(Option varClass = default, Option name = default) { VarClass = varClass; Name = name; @@ -112,8 +112,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; - Option name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -131,11 +131,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = new Option(utf8JsonReader.GetString()!); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -143,7 +143,16 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - return new Model200Response(varClass, name.Value); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + + Option varClassParsedValue = new Option(varClass.Value); + Option nameParsedValue = new Option(name.Value.Value); + + return new Model200Response(varClassParsedValue, nameParsedValue); } /// @@ -170,8 +179,10 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); + if (model200Response.Name.IsSet) + writer.WriteNumber("name", model200Response.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 21177681a89a..e53992d67f19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -36,7 +36,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(Option varClient) + public ModelClient(Option varClient = default) { VarClient = varClient; OnCreated(); @@ -103,7 +103,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = new Option(utf8JsonReader.GetString()!); + varClient = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - return new ModelClient(varClient); + if (varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + + Option varClientParsedValue = new Option(varClient.Value); + + return new ModelClient(varClientParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClient.IsSet) + writer.WriteString("client", modelClient.VarClient.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 22ac8a75383e..4a49796384a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -39,7 +39,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, Option property, Option snakeCase, Option var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; Property = property; @@ -167,10 +167,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int varName = default; - Option property = default; - Option snakeCase = default; - Option var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -189,18 +189,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = new Option(utf8JsonReader.GetString()!); + property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -208,10 +208,27 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) + if (!varName.IsSet) throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + if (varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + + if (property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + + if (snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + + if (var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + int varNameParsedValue = varName.Value.Value; + Option propertyParsedValue = new Option(property.Value); + Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); + Option var123NumberParsedValue = new Option(var123Number.Value.Value); + + return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); } /// @@ -238,10 +255,13 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + writer.WriteNumber("name", name.VarName); + if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); + if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); + if (name.Var123Number.IsSet) + writer.WriteNumber("123Number", name.Var123Number.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 1f7bca895c6f..197cb397adaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -112,8 +112,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> aObjVariableobject = default; - int pkiNotificationtestID = default; + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!; + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -144,13 +144,22 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) + if (!aObjVariableobject.IsSet) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (pkiNotificationtestID == null) + if (!pkiNotificationtestID.IsSet) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + List> aObjVariableobjectParsedValue = aObjVariableobject.Value; + int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); } /// @@ -177,6 +186,10 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + + + // hello world! + writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 8864e1b9098f..ee4372351b66 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -47,7 +47,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable, Option> objectItemsNullable, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -223,8 +223,8 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayItemsNullable = default; - Option> objectItemsNullable = default; + Option?> arrayItemsNullable = default; + Option?> objectItemsNullable = default; Option?> arrayAndItemsNullableProp = default; Option?> arrayNullableProp = default; Option booleanProp = default; @@ -253,19 +253,19 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { 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 "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 "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_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) @@ -289,14 +289,14 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT 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_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()!); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -304,7 +304,16 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + if (arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + + if (objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + + Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); + Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); + + return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -331,45 +340,94 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + + + // hello world! + + if (nullableClass.ArrayItemsNullable.IsSet) + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + + // hello world! + + if (nullableClass.ObjectItemsNullable.IsSet) + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + + // hello world! + + if (nullableClass.ArrayAndItemsNullableProp.IsSet) + if (nullableClass.ArrayAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + + // hello world! + + if (nullableClass.ArrayNullableProp.IsSet) + if (nullableClass.ArrayNullableProp.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); + if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); + if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); + + + // hello world! + + if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.ObjectAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + + // hello world! + + if (nullableClass.ObjectNullableProp.IsSet) + if (nullableClass.ObjectNullableProp.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 698c9f7969dc..223c9e028914 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -159,10 +159,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.Uuid.IsSet) + if (nullableGuidClass.Uuid.Value != null) + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index a3760690e8c7..076b7dea59d3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -136,7 +136,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +187,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,14 +195,19 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index d176b00bd66f..cb2cfe945ff7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -36,7 +36,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(Option justNumber) + public NumberOnly(Option justNumber = default) { JustNumber = justNumber; OnCreated(); @@ -103,7 +103,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -130,7 +130,12 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - return new NumberOnly(justNumber.Value); + if (justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + + Option justNumberParsedValue = new Option(justNumber.Value.Value); + + return new NumberOnly(justNumberParsedValue); } /// @@ -157,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumber.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 671a8061c8e0..168c5a6d8242 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -39,7 +39,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(Option> bars, Option deprecatedRef, Option id, Option uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -133,10 +133,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> bars = default; - Option deprecatedRef = default; - Option id = default; - Option uuid = default; + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -155,18 +155,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { 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.GetDecimal()); break; case "uuid": - uuid = new Option(utf8JsonReader.GetString()!); + uuid = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -174,7 +174,24 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + if (bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + + Option> barsParsedValue = new Option>(bars.Value); + Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); + Option idParsedValue = new Option(id.Value.Value); + Option uuidParsedValue = new Option(uuid.Value); + + return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); } /// @@ -201,12 +218,23 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + + + // hello world! + + if (objectWithDeprecatedFields.Bars.IsSet) + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + + // hello world! + + if (objectWithDeprecatedFields.DeprecatedRef.IsSet) + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); + if (objectWithDeprecatedFields.Uuid.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 4f608ed18b9f..79db334b18e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -41,7 +41,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(Option id, Option petId, Option quantity, Option shipDate, Option status, Option complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { Id = id; PetId = petId; @@ -236,12 +236,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option petId = default; - Option quantity = default; - Option shipDate = default; - Option status = default; - Option complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -260,29 +260,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = new Option(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(); - status = statusRawValue == null - ? null - : new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -290,7 +289,32 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); + + if (petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + + if (quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + + if (shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + + if (complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + + Option idParsedValue = new Option(id.Value.Value); + Option petIdParsedValue = new Option(petId.Value.Value); + Option quantityParsedValue = new Option(quantity.Value.Value); + Option shipDateParsedValue = new Option(shipDate.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option completeParsedValue = new Option(complete.Value.Value); + + return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); } /// @@ -317,18 +341,22 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); - - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); + if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); + if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); + if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); + var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.Complete.IsSet) + writer.WriteBoolean("complete", order.Complete.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index a36ae5eb0f18..52015f58fac2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -38,7 +38,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(Option myBoolean, Option myNumber, Option myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -121,9 +121,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option myBoolean = default; - Option myNumber = default; - Option myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -142,14 +142,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = new Option(utf8JsonReader.GetString()!); + myString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -157,7 +157,20 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + if (myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + + if (myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + + if (myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + + Option myBooleanParsedValue = new Option(myBoolean.Value.Value); + Option myNumberParsedValue = new Option(myNumber.Value.Value); + Option myStringParsedValue = new Option(myString.Value); + + return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); } /// @@ -184,9 +197,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); + if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); + if (outerComposite.MyString.IsSet) + writer.WriteString("my_string", outerComposite.MyString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 08ebfe841a90..a580e1d388c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -79,7 +79,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -97,7 +97,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString()!; + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -105,10 +105,15 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - return new ParentPet(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + string petTypeParsedValue = petType.Value; + + return new ParentPet(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 63d504dc1f59..a3cfc619a274 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -34,19 +34,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Option category, Option id, string name, List photoUrls, Option status, Option> tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; + Category = category; + Id = id; Status = status; Tags = tags; OnCreated(); @@ -142,18 +142,6 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("status")] public Option Status { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Option Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Name /// @@ -167,6 +155,18 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Option Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets Tags /// @@ -187,10 +187,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -231,12 +231,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option category = default; - Option id = default; - string name = default; - List photoUrls = default; - Option status = default; - Option> tags = default; + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; while (utf8JsonReader.Read()) { @@ -253,30 +253,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + case "name": + name = new Option(utf8JsonReader.GetString()!); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "name": - name = utf8JsonReader.GetString()!; + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!; + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + if (statusRawValue != null) + 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; @@ -284,13 +283,38 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (photoUrls == null) + if (!photoUrls.IsSet) throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + + if (photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + + if (category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + string nameParsedValue = name.Value; + List photoUrlsParsedValue = photoUrls.Value; + Option categoryParsedValue = new Option(category.Value); + Option idParsedValue = new Option(id.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option> tagsParsedValue = new Option>(tags.Value); + + return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); } /// @@ -317,21 +341,32 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); + writer.WriteString("name", pet.Name); + + + // hello world! + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + // hello world! + + if (pet.Category.IsSet) + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + // hello world! + + if (pet.Tags.IsSet) + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index a63753422d6f..38fe1cf1ee43 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -136,7 +136,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -187,7 +187,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,14 +195,19 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + string classNameParsedValue = className.Value; + if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, classNameParsedValue); if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 40e136136650..3919b91b28af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -136,7 +136,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -187,7 +187,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString()!; + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,14 +195,19 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 2127a01bb2b5..9e060848efe1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -103,7 +103,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString()!; + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +129,15 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + + return new QuadrilateralInterface(quadrilateralTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index f9fda3b97c52..7cd791af2900 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -37,7 +37,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(Option bar, Option baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { Bar = bar; Baz = baz; @@ -148,8 +148,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -167,10 +167,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = new Option(utf8JsonReader.GetString()!); break; case "baz": - baz = new Option(utf8JsonReader.GetString()!); + baz = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -178,7 +178,16 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - return new ReadOnlyFirst(bar, baz); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + + if (baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + + Option barParsedValue = new Option(bar.Value); + Option bazParsedValue = new Option(baz.Value); + + return new ReadOnlyFirst(barParsedValue, bazParsedValue); } /// @@ -205,8 +214,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); + if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..24fca3eb4283 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2241 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDateProp = notRequiredNullableDateProp; + NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumString = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringProp = notrequiredNullableStringProp; + NotrequiredNullableUuid = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public Option NotrequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public Option NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public Option NotrequiredNullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public Option NotrequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public Option NotrequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public Option NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public Option NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public Option> NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public Option NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public Option NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public Option NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Option NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public Option NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public Option NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public Option?> NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public Option NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public Option NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public Option NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Option NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + + if (requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; + List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; + bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; + DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; + RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; + OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; + string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; + Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; + int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; + Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); + Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); + Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); + Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); + Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); + Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); + Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); + Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); + Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); + Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); + Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); + List? requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; + bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; + DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; + DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; + RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; + RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; + RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; + int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; + OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; + string? requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; + Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; + + return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + + + // hello world! + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); + if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); + + + // hello world! + + if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); + if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); + if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); + + if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); + + + // hello world! + + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + + + // hello world! + + if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNullableArrayOfString.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index 451899418820..a667379b94d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -36,7 +36,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(Option varReturn) + public Return(Option varReturn = default) { VarReturn = varReturn; OnCreated(); @@ -103,7 +103,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -130,7 +130,12 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - return new Return(varReturn.Value); + if (varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + + Option varReturnParsedValue = new Option(varReturn.Value.Value); + + return new Return(varReturnParsedValue); } /// @@ -157,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturn.IsSet) + writer.WriteNumber("return", varReturn.VarReturn.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 947df05311f5..86342f8adda0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -37,7 +37,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(Option role, Option roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { Role = role; RoleUuid = roleUuid; @@ -112,8 +112,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option role = default; - Option roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { 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.GetGuid()); break; default: break; @@ -144,7 +144,16 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - return new RolesReportsHash(role, roleUuid.Value); + if (role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + + if (roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + + Option roleParsedValue = new Option(role.Value); + Option roleUuidParsedValue = new Option(roleUuid.Value.Value); + + return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); } /// @@ -171,9 +180,16 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + + + // hello world! + + if (rolesReportsHash.Role.IsSet) + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + + if (rolesReportsHash.RoleUuid.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 7cdf087c8c5f..b038a54c8ddb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -36,7 +36,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(Option name) + public RolesReportsHashRole(Option name = default) { Name = name; OnCreated(); @@ -103,7 +103,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - return new RolesReportsHashRole(name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + + Option nameParsedValue = new Option(name.Value); + + return new RolesReportsHashRole(nameParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.Name.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index e08db2ae55d2..fe7e8e10a802 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -112,8 +112,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -131,10 +131,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString()!; + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,13 +142,22 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -175,8 +184,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index c951f90f2e15..1005f0ec914f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -136,7 +136,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +187,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,14 +195,19 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 2770c2092b87..ccc203d62dc8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -103,7 +103,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +129,15 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - return new ShapeInterface(shapeType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + string shapeTypeParsedValue = shapeType.Value; + + return new ShapeInterface(shapeTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index d935935466ff..fbc7ce7ea067 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -136,7 +136,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +187,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -195,14 +195,19 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 95b31cbbe391..0f28ae26f825 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -112,8 +112,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -131,10 +131,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString()!; + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString()!; + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,13 +142,22 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -175,8 +184,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 40a6ca2bde40..e0c92a2bd95e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -37,7 +37,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(Option varSpecialModelName, Option specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -112,8 +112,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varSpecialModelName = default; - Option specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -131,11 +131,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = new Option(utf8JsonReader.GetString()!); + varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -143,7 +143,16 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + if (varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + + if (specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + + Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); + Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); + + return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); } /// @@ -170,8 +179,10 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); + if (specialModelName.SpecialPropertyName.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index 0e2d3c0f9844..a14d267861f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -37,7 +37,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(Option id, Option name) + public Tag(Option id = default, Option name = default) { Id = id; Name = name; @@ -112,8 +112,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = new Option(utf8JsonReader.GetString()!); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,7 +143,16 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - return new Tag(id.Value, name); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + + Option idParsedValue = new Option(id.Value.Value); + Option nameParsedValue = new Option(name.Value); + + return new Tag(idParsedValue, nameParsedValue); } /// @@ -170,8 +179,10 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); + if (tag.Name.IsSet) + writer.WriteString("name", tag.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index c3cb3e930bfa..cea6972f8c71 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -36,7 +36,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(Option value) + public TestCollectionEndingWithWordList(Option value = default) { Value = value; OnCreated(); @@ -103,7 +103,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = new Option(utf8JsonReader.GetString()!); + value = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,7 +129,12 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - return new TestCollectionEndingWithWordList(value); + if (value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + + Option valueParsedValue = new Option(value.Value); + + return new TestCollectionEndingWithWordList(valueParsedValue); } /// @@ -156,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.Value.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 93020137dddb..35e933672b44 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -36,7 +36,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -103,7 +103,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> testCollectionEndingWithWordList = default; + Option?> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { 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; @@ -130,7 +130,12 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + if (testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + + Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); } /// @@ -157,8 +162,13 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + + + // hello world! + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 602a2c7f6c61..88dd258c515c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -36,7 +36,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { SomeProperty = someProperty; OnCreated(); @@ -114,7 +114,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -132,7 +132,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = new Option(utf8JsonReader.GetString()!); + someProperty = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -140,7 +140,12 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + if (someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + + Option somePropertyParsedValue = new Option(someProperty.Value); + + return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); } /// @@ -167,7 +172,8 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 18f52e625e4c..8f9b50ad5cbc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -153,7 +153,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -210,7 +210,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString()!; + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -218,17 +218,22 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + string triangleTypeParsedValue = triangleType.Value; + if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleTypeParsedValue); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleTypeParsedValue); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index a7f5a23391b8..16648dc65aa8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -103,7 +103,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -121,7 +121,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString()!; + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +129,15 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - return new TriangleInterface(triangleType); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + string triangleTypeParsedValue = triangleType.Value; + + return new TriangleInterface(triangleTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index b96ac1bb482d..ba83f2b2373c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -47,7 +47,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email, Option firstName, Option id, Option lastName, Option objectWithNoDeclaredProps, Option password, Option phone, Option userStatus, Option username, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -207,15 +207,15 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option email = default; - Option firstName = default; - Option id = default; - Option lastName = default; - Option objectWithNoDeclaredProps = default; - Option password = default; - Option phone = default; - Option userStatus = default; - Option username = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; Option anyTypeProp = default; Option anyTypePropNullable = default; Option objectWithNoDeclaredPropsNullable = default; @@ -236,46 +236,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = new Option(utf8JsonReader.GetString()!); + email = new Option(utf8JsonReader.GetString()!); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = new Option(utf8JsonReader.GetString()!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + 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 "password": - password = new Option(utf8JsonReader.GetString()!); + password = new Option(utf8JsonReader.GetString()!); break; case "phone": - phone = new Option(utf8JsonReader.GetString()!); + phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = new Option(utf8JsonReader.GetString()!); + username = new Option(utf8JsonReader.GetString()!); break; 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 "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -283,7 +283,44 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + if (email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + + if (objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + + if (phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + + if (userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + + if (username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + + Option emailParsedValue = new Option(email.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option idParsedValue = new Option(id.Value.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); + Option passwordParsedValue = new Option(password.Value); + Option phoneParsedValue = new Option(phone.Value); + Option userStatusParsedValue = new Option(userStatus.Value.Value); + Option usernameParsedValue = new Option(username.Value); + + return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -310,22 +347,63 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); + if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); + if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); + if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); + + + // hello world! + + if (user.ObjectWithNoDeclaredProps.IsSet) + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); + if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); + if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); + if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); + + + // hello world! + + if (user.AnyTypeProp.IsSet) + if (user.AnyTypeProp.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + + // hello world! + + if (user.AnyTypePropNullable.IsSet) + if (user.AnyTypePropNullable.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + + // hello world! + + if (user.ObjectWithNoDeclaredPropsNullable.IsSet) + if (user.ObjectWithNoDeclaredPropsNullable.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 06035e5d63bf..6c9b65044d5c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -38,7 +38,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, Option hasBaleen, Option hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; HasBaleen = hasBaleen; @@ -121,9 +121,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Option hasBaleen = default; - Option hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -141,15 +141,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -157,10 +157,23 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + + if (hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + + if (hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + string classNameParsedValue = className.Value; + Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); + Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); + + return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); } /// @@ -187,9 +200,11 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + writer.WriteString("className", whale.ClassName); + if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); + if (whale.HasTeeth.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index faf8a0789e2b..7d7898ac1bc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -37,7 +37,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, Option type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; Type = type; @@ -203,8 +203,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Option type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -222,13 +222,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString()!; + className = new Option(utf8JsonReader.GetString()!); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -236,10 +235,19 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - return new Zebra(className, type.Value); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); + + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + string classNameParsedValue = className.Value; + Option typeParsedValue = new Option(type.Value.Value); + + return new Zebra(classNameParsedValue, typeParsedValue); } /// @@ -266,9 +274,8 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); - - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + writer.WriteString("className", zebra.ClassName); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 4ea71d55737b..5305591a209e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -36,7 +36,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(Option zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -169,7 +169,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -188,9 +188,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -198,7 +197,12 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + if (zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); + + Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + + return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); } /// @@ -225,8 +229,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else From a450627e19148e5a07d9ee3f4f0e72f2b112f762 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Oct 2023 14:10:03 -0400 Subject: [PATCH 03/23] completed changes using latest-nrt sample --- .../languages/AbstractCSharpCodegen.java | 1 + .../resources/csharp/ValidateRegex.mustache | 2 +- .../generichost/JsonConverter.mustache | 17 +- .../libraries/generichost/Option.mustache | 12 + .../resources/csharp/validatable.mustache | 8 +- .../UnitTest1.cs | 17 +- .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 + .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +-- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 390 +++++++++++++++++- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 4 - .../ActivityOutputElementRepresentation.cs | 10 +- .../Model/AdditionalPropertiesClass.cs | 25 -- .../src/Org.OpenAPITools/Model/Apple.cs | 18 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 4 - .../Model/ArrayOfNumberOnly.cs | 4 - .../src/Org.OpenAPITools/Model/ArrayTest.cs | 10 - .../src/Org.OpenAPITools/Model/Drawing.cs | 13 - .../src/Org.OpenAPITools/Model/EnumArrays.cs | 4 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../Model/FileSchemaTestClass.cs | 7 - .../Model/FooGetDefaultResponse.cs | 4 - .../src/Org.OpenAPITools/Model/FormatTest.cs | 63 ++- .../src/Org.OpenAPITools/Model/GmFruit.cs | 12 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 13 - ...dPropertiesAndAdditionalPropertiesClass.cs | 22 +- ...cationtestGetElementsV1ResponseMPayload.cs | 4 - .../Org.OpenAPITools/Model/NullableClass.cs | 22 +- .../Model/NullableGuidClass.cs | 1 - .../Model/ObjectWithDeprecatedFields.cs | 7 - .../src/Org.OpenAPITools/Model/Pet.cs | 11 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 36 +- .../Model/RolesReportsHash.cs | 5 - .../TestCollectionEndingWithWordListObject.cs | 4 - .../src/Org.OpenAPITools/Model/User.cs | 18 +- 38 files changed, 555 insertions(+), 347 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 4d2e919b1a7f..6e466aa89041 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -419,6 +419,7 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("required", new RequiredParameterLambda()) .put("optional", new OptionalParameterLambda().generator(this)) .put("joinWithComma", new JoinWithCommaLambda()) + .put("joinWithAmpersand", new JoinWithCommaLambda(true, " ", " && ")) .put("joinLinesWithComma", new JoinWithCommaLambda(false, "\n", ",\n")) .put("joinConditions", new JoinWithCommaLambda(true, " ", " && ")) .put("trimLineBreaks", new TrimLineBreaksLambda()) diff --git a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache index 15cf626dc012..76bb9f798f0c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache @@ -1,6 +1,6 @@ // {{{name}}} ({{{dataType}}}) pattern Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); -if (!regex{{{name}}}.Match(this.{{{name}}}{{#isUuid}}.ToString(){{/isUuid}}).Success) +if (!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); } \ No newline at end of file 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 f001815161fe..4c3562bca062 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 @@ -354,10 +354,10 @@ {{^model.discriminator}} {{#composedSchemas}} {{#anyOf}} - if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}} != null) + if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}.IsSet {{/required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}} != null{{/lambda.joinWithAmpersand}}) { - {{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}.GetType())); - {{datatypeWithEnum}}JsonConverter.WriteProperties(ref writer, {{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}, jsonSerializerOptions); + {{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}}.GetType())); + {{datatypeWithEnum}}JsonConverter.WriteProperties(ref writer, {{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}}, jsonSerializerOptions); } {{/anyOf}} @@ -498,7 +498,7 @@ if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) { var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value.Value); - writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); + writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } else writer.WriteNull("{{baseName}}"); @@ -506,7 +506,7 @@ {{^isNullable}} { var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); - writer.WriteString("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); + writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } {{/isNullable}} {{/required}} @@ -515,7 +515,6 @@ {{/isMap}} {{/isEnum}} {{#isUuid}} - {{#lambda.copy}} writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); {{/lambda.copy}} @@ -530,12 +529,6 @@ {{^isNumeric}} {{^isDate}} {{^isDateTime}} - - - - - // hello world! - {{#required}} {{#isNullable}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache index 8e0d888a2244..d34126964b12 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache @@ -31,5 +31,17 @@ namespace {{packageName}}.{{clientPackage}} IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/validatable.mustache b/modules/openapi-generator/src/main/resources/csharp/validatable.mustache index 2352d0d55178..5589fcb0d4bc 100644 --- a/modules/openapi-generator/src/main/resources/csharp/validatable.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/validatable.mustache @@ -78,7 +78,7 @@ {{/minLength}} {{#maximum}} // {{{name}}} ({{{dataType}}}) maximum - if (this.{{{name}}} > ({{{dataType}}}){{maximum}}) + if ({{#useGenericHost}}{{^required}}this.{{{name}}}.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} > ({{{dataType}}}){{maximum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" }); } @@ -86,7 +86,7 @@ {{/maximum}} {{#minimum}} // {{{name}}} ({{{dataType}}}) minimum - if (this.{{{name}}} < ({{{dataType}}}){{minimum}}) + if ({{#useGenericHost}}{{^required}}this.{{{name}}}.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} < ({{{dataType}}}){{minimum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" }); } @@ -96,7 +96,7 @@ {{^isByteArray}} {{#vendorExtensions.x-is-value-type}} {{#isNullable}} - if (this.{{{name}}} != null){ + if (this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} != null){ {{#lambda.trimTrailingWithNewLine}} {{#lambda.indent4}} {{>ValidateRegex}} @@ -116,7 +116,7 @@ {{/isNullable}} {{/vendorExtensions.x-is-value-type}} {{^vendorExtensions.x-is-value-type}} - if (this.{{{name}}} != null) { + if (this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} != null) { {{#lambda.trimTrailingWithNewLine}} {{#lambda.indent4}} {{>ValidateRegex}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs index 1dc4e1bcbd06..9bf06b341412 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs @@ -87,17 +87,14 @@ public void GmFruit() string gmFruitJson = JsonSerializer.Serialize(gmFruit, _jsonSerializerOptions); GmFruit? gmFruit2 = JsonSerializer.Deserialize(gmFruitJson, _jsonSerializerOptions); Assert.IsTrue( - gmFruit.Apple != null && - gmFruit.Banana != null && + gmFruit.Apple.Value != null && + gmFruit.Banana.Value != null && gmFruit2 != null && - gmFruit2.Apple != null && - gmFruit2.Banana != null && - gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && - gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && - gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); - - Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); - Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); + gmFruit2.Apple.Value != null && + gmFruit2.Banana.Value != null && + gmFruit2.Apple.Value.Cultivar.Equals(gmFruit.Apple.Value.Cultivar) && + gmFruit2.Apple.Value.Origin.Equals(gmFruit.Apple.Value.Origin) && + gmFruit2.Banana.Value.LengthCm.Equals(gmFruit.Banana.Value.LengthCm)); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 758fb96ce8b8..feaae2e67180 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index 7fe8f333c81a..b78fc06d07c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f428662..bfec38903066 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -89,15 +98,6 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af78..164baa8862be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ public void FormatTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ public void DateTest() // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faad..8485d1213ce6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs index 69ed03711e55..6e8958b1b749 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -54,21 +54,399 @@ public void RequiredClassInstanceTest() } /// - /// Test the property 'BooleanProp' + /// Test the property 'RequiredNotNullableDateProp' /// [Fact] - public void BooleanPropTest() + public void RequiredNotNullableDatePropTest() { - // TODO unit test for the property 'BooleanProp' + // TODO unit test for the property 'RequiredNotNullableDateProp' } /// - /// Test the property 'NullableBooleanProp' + /// Test the property 'RequiredNotnullableArrayOfString' /// [Fact] - public void NullableBooleanPropTest() + public void RequiredNotnullableArrayOfStringTest() { - // TODO unit test for the property 'NullableBooleanProp' + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs index 7aa655c9b813..4af2a7715ee6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index 02060469b79b..7872f668a3aa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -162,10 +162,6 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (activity.ActivityOutputs.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 33100692726d..49a721261b9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -179,13 +179,9 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); - - - // hello world! - - if (activityOutputElementRepresentation.Prop2.IsSet) + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); + if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4db1d574121b..1c8d83f25c11 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -285,52 +285,27 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (additionalPropertiesClass.EmptyMap.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapOfMapProperty.IsSet) writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapProperty.IsSet) writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - - // hello world! - if (additionalPropertiesClass.Anytype1.IsSet) if (additionalPropertiesClass.Anytype1.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index 47c5822c6b19..1ae7d69315d3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -95,28 +95,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCode.Value != null) { // ColorCode (string) pattern - Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); // a - if (!regexColorCode.Match(this.ColorCode).Success) + Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); + if (!regexColorCode.Match(this.ColorCode.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.Cultivar.Value != null) { // Cultivar (string) pattern - Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); // a - if (!regexCultivar.Match(this.Cultivar).Success) + Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); + if (!regexCultivar.Match(this.Cultivar.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.Origin.Value != null) { // Origin (string) pattern - Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a - if (!regexOrigin.Match(this.Origin).Success) + Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexOrigin.Match(this.Origin.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index c3fdbde7e5ab..707b2149e429 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -162,10 +162,6 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 41e7be6c9681..aac4f72bb49d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -162,10 +162,6 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (arrayOfNumberOnly.ArrayNumber.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 75f8bc53bdd5..a373fb4c98ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -198,22 +198,12 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (arrayTest.ArrayArrayOfInteger.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - - // hello world! - if (arrayTest.ArrayArrayOfModel.IsSet) writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - - // hello world! - if (arrayTest.ArrayOfString.IsSet) writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index d025f1ddb68e..2fa3b6ca9d34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -219,22 +219,12 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (drawing.MainShape.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - - // hello world! - if (drawing.Shapes.IsSet) writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - - // hello world! - if (drawing.NullableShape.IsSet) if (drawing.NullableShape.Value != null) { @@ -243,9 +233,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("nullableShape"); - - // hello world! - if (drawing.ShapeOrNull.IsSet) if (drawing.ShapeOrNull.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index c6883f00029c..d27296996989 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -313,10 +313,6 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (enumArrays.ArrayEnum.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index d43c11396a86..05fc1782649a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -821,12 +821,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe if (enumTest.OuterEnumInteger.IsSet) { var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); - writer.WriteString("outerEnumInteger", outerEnumIntegerRawValue); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } if (enumTest.OuterEnumIntegerDefaultValue.IsSet) { var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); - writer.WriteString("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } if (enumTest.OuterEnum.IsSet) if (enumTest.OuterEnum.Value != null) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index ea5fcfca1efa..30920b343574 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -180,16 +180,9 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (fileSchemaTestClass.File.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - - // hello world! - if (fileSchemaTestClass.Files.IsSet) writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index bbefb8d3fcf3..11517251dbd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -162,10 +162,6 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (fooGetDefaultResponse.VarString.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 122f0522b049..539a83d6d5ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -270,97 +270,97 @@ public override string ToString() } // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32.IsSet && this.Int32.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32.IsSet && this.Int32.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.Integer.IsSet && this.Integer.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.Integer.IsSet && this.Integer.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslash.Value != null) { // PatternWithBackslash (string) pattern - Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); // a - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigits.Value != null) { // PatternWithDigits (string) pattern - Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); // a - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); + if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiter.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern - Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarString.Value != null) { // VarString (string) pattern - Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); // a - if (!regexVarString.Match(this.VarString).Success) + Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); + if (!regexVarString.Match(this.VarString.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -629,29 +629,17 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); - - - // hello world! - - if (formatTest.Binary.IsSet) + if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTime.IsSet) writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); - - - // hello world! - - if (formatTest.VarDecimal.IsSet) + if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDouble.IsSet) @@ -676,8 +664,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); - - if (formatTest.Uuid.IsSet) + if (formatTest.Uuid.IsSet) writer.WriteString("uuid", formatTest.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index b39989133a70..b743db6ecef8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -179,16 +179,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index 0c111fc625a9..e0edd3018aea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -282,28 +282,15 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (mapTest.DirectMap.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - - // hello world! - if (mapTest.IndirectMap.IsSet) writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - - // hello world! - if (mapTest.MapMapOfString.IsSet) writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - - // hello world! - if (mapTest.MapOfEnumString.IsSet) writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 44a1389da4b4..e39cc6d770c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -105,8 +105,8 @@ public override string ToString() IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { // UuidWithPattern (Guid) pattern - Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); // a - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); + if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -227,20 +227,14 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); - - - // hello world! - - if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); + if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); - - if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 197cb397adaa..2497fc35489e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -186,10 +186,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index ee4372351b66..c37e7b637e6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -340,22 +340,12 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (nullableClass.ArrayItemsNullable.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - - // hello world! - if (nullableClass.ObjectItemsNullable.IsSet) writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - - // hello world! - if (nullableClass.ArrayAndItemsNullableProp.IsSet) if (nullableClass.ArrayAndItemsNullableProp.Value != null) { @@ -364,9 +354,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); - - // hello world! - if (nullableClass.ArrayNullableProp.IsSet) if (nullableClass.ArrayNullableProp.Value != null) { @@ -400,11 +387,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); else writer.WriteNull("number_prop"); - - - // hello world! - - if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.ObjectAndItemsNullableProp.IsSet) if (nullableClass.ObjectAndItemsNullableProp.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -412,9 +395,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); - - // hello world! - if (nullableClass.ObjectNullableProp.IsSet) if (nullableClass.ObjectNullableProp.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 223c9e028914..766d377df021 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -158,7 +158,6 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid.IsSet) if (nullableGuidClass.Uuid.Value != null) writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 168c5a6d8242..ce4ba8ffc363 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -218,16 +218,9 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (objectWithDeprecatedFields.Bars.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - - // hello world! - if (objectWithDeprecatedFields.DeprecatedRef.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index a3cfc619a274..368758b4b03e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -342,15 +342,8 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { writer.WriteString("name", pet.Name); - - - // hello world! - - writer.WritePropertyName("photoUrls"); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - - // hello world! - if (pet.Category.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); @@ -362,8 +355,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp else writer.WriteNull("status"); - // hello world! - if (pet.Tags.IsSet) writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index 24fca3eb4283..1a33b872facc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2050,11 +2050,7 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); - - - // hello world! - - writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); @@ -2070,18 +2066,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); - - - // hello world! - - if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) @@ -2105,14 +2096,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } if (requiredClass.NotrequiredNotnullableStringProp.IsSet) writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); - - if (requiredClass.NotrequiredNotnullableUuid.IsSet) + if (requiredClass.NotrequiredNotnullableUuid.IsSet) writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); - - - // hello world! - - if (requiredClass.RequiredNullableArrayOfString != null) + if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2164,8 +2150,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); - - if (requiredClass.RequiredNullableUuid != null) + if (requiredClass.RequiredNullableUuid != null) writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); @@ -2179,11 +2164,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); else writer.WriteNull("not_required_nullable_integer_prop"); - - - // hello world! - - if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNullableArrayOfString.IsSet) if (requiredClass.NotrequiredNullableArrayOfString.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2230,8 +2211,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); else writer.WriteNull("notrequired_nullable_string_prop"); - - if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.IsSet) if (requiredClass.NotrequiredNullableUuid.Value != null) writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 86342f8adda0..b928d426dd35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -180,14 +180,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (rolesReportsHash.Role.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - if (rolesReportsHash.RoleUuid.IsSet) writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 35e933672b44..5de7d3475de1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -162,10 +162,6 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - - - // hello world! - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index ba83f2b2373c..34f74e862a83 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -355,11 +355,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) writer.WriteString("lastName", user.LastName.Value); - - - // hello world! - - if (user.ObjectWithNoDeclaredProps.IsSet) + if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.Password.IsSet) @@ -370,11 +366,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) writer.WriteString("username", user.Username.Value); - - - // hello world! - - if (user.AnyTypeProp.IsSet) + if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); @@ -382,9 +374,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypeProp"); - - // hello world! - if (user.AnyTypePropNullable.IsSet) if (user.AnyTypePropNullable.Value != null) { @@ -393,9 +382,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypePropNullable"); - - // hello world! - if (user.ObjectWithNoDeclaredPropsNullable.IsSet) if (user.ObjectWithNoDeclaredPropsNullable.Value != null) { From 763ac2911011c21ef90e7ab01b049552f488513f Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Oct 2023 14:38:22 -0400 Subject: [PATCH 04/23] fixed all samples --- .../resources/csharp/modelInnerEnum.mustache | 3 +- .../.openapi-generator/FILES | 2 + .../README.md | 1 + .../api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1954 +++++++++++++++ .../UnitTest1.cs | 19 +- .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Api/FakeApiTests.cs | 10 + .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ++++ .../UseSourceGeneration/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 2 + .../src/UseSourceGeneration/Client/Option.cs | 12 + .../src/UseSourceGeneration/Model/Activity.cs | 21 +- .../ActivityOutputElementRepresentation.cs | 35 +- .../Model/AdditionalPropertiesClass.cs | 133 +- .../src/UseSourceGeneration/Model/Animal.cs | 31 +- .../UseSourceGeneration/Model/ApiResponse.cs | 47 +- .../src/UseSourceGeneration/Model/Apple.cs | 59 +- .../src/UseSourceGeneration/Model/AppleReq.cs | 31 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 21 +- .../Model/ArrayOfNumberOnly.cs | 21 +- .../UseSourceGeneration/Model/ArrayTest.cs | 53 +- .../src/UseSourceGeneration/Model/Banana.cs | 19 +- .../UseSourceGeneration/Model/BananaReq.cs | 31 +- .../UseSourceGeneration/Model/BasquePig.cs | 13 +- .../Model/Capitalization.cs | 89 +- .../src/UseSourceGeneration/Model/Cat.cs | 43 +- .../src/UseSourceGeneration/Model/Category.cs | 53 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 36 +- .../UseSourceGeneration/Model/ClassModel.cs | 19 +- .../Model/ComplexQuadrilateral.cs | 27 +- .../UseSourceGeneration/Model/DanishPig.cs | 13 +- .../Model/DateOnlyClass.cs | 19 +- .../Model/DeprecatedObject.cs | 19 +- .../src/UseSourceGeneration/Model/Dog.cs | 51 +- .../src/UseSourceGeneration/Model/Drawing.cs | 69 +- .../UseSourceGeneration/Model/EnumArrays.cs | 38 +- .../src/UseSourceGeneration/Model/EnumTest.cs | 497 ++-- .../Model/EquilateralTriangle.cs | 27 +- .../src/UseSourceGeneration/Model/File.cs | 19 +- .../Model/FileSchemaTestClass.cs | 37 +- .../src/UseSourceGeneration/Model/Foo.cs | 19 +- .../Model/FooGetDefaultResponse.cs | 21 +- .../UseSourceGeneration/Model/FormatTest.cs | 423 ++-- .../src/UseSourceGeneration/Model/Fruit.cs | 23 +- .../src/UseSourceGeneration/Model/GmFruit.cs | 38 +- .../Model/GrandparentAnimal.cs | 13 +- .../Model/HasOnlyReadOnly.cs | 33 +- .../Model/HealthCheckResult.cs | 14 +- .../Model/IsoscelesTriangle.cs | 27 +- .../src/UseSourceGeneration/Model/List.cs | 19 +- .../Model/LiteralStringClass.cs | 33 +- .../src/UseSourceGeneration/Model/Mammal.cs | 17 +- .../src/UseSourceGeneration/Model/MapTest.cs | 69 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 65 +- .../Model/Model200Response.cs | 33 +- .../UseSourceGeneration/Model/ModelClient.cs | 19 +- .../src/UseSourceGeneration/Model/Name.cs | 59 +- ...cationtestGetElementsV1ResponseMPayload.cs | 23 +- .../Model/NullableClass.cs | 194 +- .../Model/NullableGuidClass.cs | 18 +- .../Model/NullableShape.cs | 15 +- .../UseSourceGeneration/Model/NumberOnly.cs | 19 +- .../Model/ObjectWithDeprecatedFields.cs | 65 +- .../src/UseSourceGeneration/Model/Order.cs | 92 +- .../Model/OuterComposite.cs | 47 +- .../UseSourceGeneration/Model/ParentPet.cs | 13 +- .../src/UseSourceGeneration/Model/Pet.cs | 138 +- .../src/UseSourceGeneration/Model/Pig.cs | 15 +- .../Model/Quadrilateral.cs | 15 +- .../Model/QuadrilateralInterface.cs | 13 +- .../Model/ReadOnlyFirst.cs | 33 +- .../Model/RequiredClass.cs | 2231 +++++++++++++++++ .../src/UseSourceGeneration/Model/Return.cs | 19 +- .../Model/RolesReportsHash.cs | 35 +- .../Model/RolesReportsHashRole.cs | 19 +- .../Model/ScaleneTriangle.cs | 27 +- .../src/UseSourceGeneration/Model/Shape.cs | 15 +- .../Model/ShapeInterface.cs | 13 +- .../UseSourceGeneration/Model/ShapeOrNull.cs | 15 +- .../Model/SimpleQuadrilateral.cs | 27 +- .../Model/SpecialModelName.cs | 33 +- .../src/UseSourceGeneration/Model/Tag.cs | 33 +- .../Model/TestCollectionEndingWithWordList.cs | 19 +- .../TestCollectionEndingWithWordListObject.cs | 21 +- ...lineFreeformAdditionalPropertiesRequest.cs | 19 +- .../src/UseSourceGeneration/Model/Triangle.cs | 17 +- .../Model/TriangleInterface.cs | 13 +- .../src/UseSourceGeneration/Model/User.cs | 181 +- .../src/UseSourceGeneration/Model/Whale.cs | 45 +- .../src/UseSourceGeneration/Model/Zebra.cs | 34 +- .../Model/ZeroBasedEnumClass.cs | 22 +- .../.openapi-generator/VERSION | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 2 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2 + .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 + .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 22 +- .../ActivityOutputElementRepresentation.cs | 36 +- .../Model/AdditionalPropertiesClass.cs | 134 +- .../src/Org.OpenAPITools/Model/Animal.cs | 32 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 48 +- .../src/Org.OpenAPITools/Model/Apple.cs | 60 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 32 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 22 +- .../Model/ArrayOfNumberOnly.cs | 22 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 54 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 32 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 14 +- .../Org.OpenAPITools/Model/Capitalization.cs | 90 +- .../src/Org.OpenAPITools/Model/Cat.cs | 44 +- .../src/Org.OpenAPITools/Model/Category.cs | 54 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 37 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 20 +- .../Model/ComplexQuadrilateral.cs | 28 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 14 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 20 +- .../Model/DeprecatedObject.cs | 20 +- .../src/Org.OpenAPITools/Model/Dog.cs | 52 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 70 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 39 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 498 ++-- .../Model/EquilateralTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/File.cs | 20 +- .../Model/FileSchemaTestClass.cs | 38 +- .../src/Org.OpenAPITools/Model/Foo.cs | 20 +- .../Model/FooGetDefaultResponse.cs | 22 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 424 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 24 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 39 +- .../Model/GrandparentAnimal.cs | 14 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 34 +- .../Model/HealthCheckResult.cs | 15 +- .../Model/IsoscelesTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/List.cs | 20 +- .../Model/LiteralStringClass.cs | 34 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 18 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 70 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 66 +- .../Model/Model200Response.cs | 34 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 20 +- .../src/Org.OpenAPITools/Model/Name.cs | 60 +- ...cationtestGetElementsV1ResponseMPayload.cs | 24 +- .../Org.OpenAPITools/Model/NullableClass.cs | 195 +- .../Model/NullableGuidClass.cs | 19 +- .../Org.OpenAPITools/Model/NullableShape.cs | 16 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 20 +- .../Model/ObjectWithDeprecatedFields.cs | 66 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 + .../src/Org.OpenAPITools/Model/Order.cs | 93 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 48 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 14 +- .../src/Org.OpenAPITools/Model/Pet.cs | 139 +- .../src/Org.OpenAPITools/Model/Pig.cs | 16 +- .../Model/PolymorphicProperty.cs | 1 + .../Org.OpenAPITools/Model/Quadrilateral.cs | 16 +- .../Model/QuadrilateralInterface.cs | 14 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 34 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2221 ++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 20 +- .../Model/RolesReportsHash.cs | 36 +- .../Model/RolesReportsHashRole.cs | 20 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/Shape.cs | 16 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 14 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 16 +- .../Model/SimpleQuadrilateral.cs | 28 +- .../Model/SpecialModelName.cs | 34 +- .../src/Org.OpenAPITools/Model/Tag.cs | 34 +- .../Model/TestCollectionEndingWithWordList.cs | 20 +- .../TestCollectionEndingWithWordListObject.cs | 22 +- ...lineFreeformAdditionalPropertiesRequest.cs | 20 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 18 +- .../Model/TriangleInterface.cs | 14 +- .../src/Org.OpenAPITools/Model/User.cs | 182 +- .../src/Org.OpenAPITools/Model/Whale.cs | 46 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 35 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 23 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Adult.cs | 58 +- .../src/Org.OpenAPITools/Model/Child.cs | 70 +- .../src/Org.OpenAPITools/Model/Person.cs | 48 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Apple.cs | 20 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 39 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Apple.cs | 20 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 24 +- .../.openapi-generator/FILES | 2 + .../.openapi-generator/VERSION | 2 +- .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 + .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 22 +- .../ActivityOutputElementRepresentation.cs | 36 +- .../Model/AdditionalPropertiesClass.cs | 134 +- .../src/Org.OpenAPITools/Model/Animal.cs | 32 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 48 +- .../src/Org.OpenAPITools/Model/Apple.cs | 60 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 32 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 22 +- .../Model/ArrayOfNumberOnly.cs | 22 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 54 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 32 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 14 +- .../Org.OpenAPITools/Model/Capitalization.cs | 90 +- .../src/Org.OpenAPITools/Model/Cat.cs | 44 +- .../src/Org.OpenAPITools/Model/Category.cs | 54 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 35 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 20 +- .../Model/ComplexQuadrilateral.cs | 28 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 14 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 22 +- .../Model/DeprecatedObject.cs | 20 +- .../src/Org.OpenAPITools/Model/Dog.cs | 52 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 70 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 37 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 482 ++-- .../Model/EquilateralTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/File.cs | 20 +- .../Model/FileSchemaTestClass.cs | 38 +- .../src/Org.OpenAPITools/Model/Foo.cs | 20 +- .../Model/FooGetDefaultResponse.cs | 22 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 426 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 24 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 39 +- .../Model/GrandparentAnimal.cs | 14 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 34 +- .../Model/HealthCheckResult.cs | 15 +- .../Model/IsoscelesTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/List.cs | 20 +- .../Model/LiteralStringClass.cs | 34 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 18 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 70 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 66 +- .../Model/Model200Response.cs | 34 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 20 +- .../src/Org.OpenAPITools/Model/Name.cs | 60 +- ...cationtestGetElementsV1ResponseMPayload.cs | 24 +- .../Org.OpenAPITools/Model/NullableClass.cs | 195 +- .../Model/NullableGuidClass.cs | 19 +- .../Org.OpenAPITools/Model/NullableShape.cs | 16 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 20 +- .../Model/ObjectWithDeprecatedFields.cs | 66 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 + .../src/Org.OpenAPITools/Model/Order.cs | 91 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 48 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 14 +- .../src/Org.OpenAPITools/Model/Pet.cs | 137 +- .../src/Org.OpenAPITools/Model/Pig.cs | 16 +- .../Model/PolymorphicProperty.cs | 1 + .../Org.OpenAPITools/Model/Quadrilateral.cs | 16 +- .../Model/QuadrilateralInterface.cs | 14 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 34 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2221 ++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 20 +- .../Model/RolesReportsHash.cs | 36 +- .../Model/RolesReportsHashRole.cs | 20 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 28 +- .../src/Org.OpenAPITools/Model/Shape.cs | 16 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 14 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 16 +- .../Model/SimpleQuadrilateral.cs | 28 +- .../Model/SpecialModelName.cs | 34 +- .../src/Org.OpenAPITools/Model/Tag.cs | 34 +- .../Model/TestCollectionEndingWithWordList.cs | 20 +- .../TestCollectionEndingWithWordListObject.cs | 22 +- ...lineFreeformAdditionalPropertiesRequest.cs | 20 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 18 +- .../Model/TriangleInterface.cs | 14 +- .../src/Org.OpenAPITools/Model/User.cs | 182 +- .../src/Org.OpenAPITools/Model/Whale.cs | 46 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 33 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 21 +- .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-httpclient/README.md | 1 + .../OpenAPIClient-httpclient/api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1043 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net47/README.md | 1 + .../OpenAPIClient-net47/api/openapi.yaml | 258 ++ .../OpenAPIClient-net47/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net48/README.md | 1 + .../OpenAPIClient-net48/api/openapi.yaml | 258 ++ .../OpenAPIClient-net48/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net5.0/README.md | 1 + .../OpenAPIClient-net5.0/api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-unityWebRequest/README.md | 1 + .../api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 410 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1224 +++++++++ .../OpenAPIClient/.openapi-generator/FILES | 2 + .../petstore/csharp/OpenAPIClient/README.md | 1 + .../csharp/OpenAPIClient/api/openapi.yaml | 258 ++ .../OpenAPIClient/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClientCore/README.md | 1 + .../csharp/OpenAPIClientCore/api/openapi.yaml | 258 ++ .../OpenAPIClientCore/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1027 ++++++++ 375 files changed, 31766 insertions(+), 5181 deletions(-) create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache index 786452d4b6d4..3ea602546391 100644 --- a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache @@ -74,7 +74,7 @@ {{#isString}} /// {{/isString}} - public static {{>EnumValueDataType}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} value) + public static {{>EnumValueDataType}}{{#nrt}}{{#isString}}{{>NullConditionalProperty}}{{/isString}}{{/nrt}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} value) { {{^isString}} return ({{>EnumValueDataType}}) value; @@ -83,6 +83,7 @@ {{#isNullable}} if (value == null) return null; + {{/isNullable}} {{#allowableValues}} {{#enumVars}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md index af827f28641e..c2d5ddeb3539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md @@ -221,6 +221,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..a3bfdf702066 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1954 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger + { + get{ return _RequiredNullableEnumInteger;} + set + { + _RequiredNullableEnumInteger = value; + _flagRequiredNullableEnumInteger = true; + } + } + private RequiredNullableEnumIntegerEnum _RequiredNullableEnumInteger; + private bool _flagRequiredNullableEnumInteger; + + /// + /// Returns false as RequiredNullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumInteger() + { + return _flagRequiredNullableEnumInteger; + } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger + { + get{ return _RequiredNotnullableEnumInteger;} + set + { + _RequiredNotnullableEnumInteger = value; + _flagRequiredNotnullableEnumInteger = true; + } + } + private RequiredNotnullableEnumIntegerEnum _RequiredNotnullableEnumInteger; + private bool _flagRequiredNotnullableEnumInteger; + + /// + /// Returns false as RequiredNotnullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumInteger() + { + return _flagRequiredNotnullableEnumInteger; + } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger + { + get{ return _NotrequiredNullableEnumInteger;} + set + { + _NotrequiredNullableEnumInteger = value; + _flagNotrequiredNullableEnumInteger = true; + } + } + private NotrequiredNullableEnumIntegerEnum? _NotrequiredNullableEnumInteger; + private bool _flagNotrequiredNullableEnumInteger; + + /// + /// Returns false as NotrequiredNullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumInteger() + { + return _flagNotrequiredNullableEnumInteger; + } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger + { + get{ return _NotrequiredNotnullableEnumInteger;} + set + { + _NotrequiredNotnullableEnumInteger = value; + _flagNotrequiredNotnullableEnumInteger = true; + } + } + private NotrequiredNotnullableEnumIntegerEnum? _NotrequiredNotnullableEnumInteger; + private bool _flagNotrequiredNotnullableEnumInteger; + + /// + /// Returns false as NotrequiredNotnullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumInteger() + { + return _flagNotrequiredNotnullableEnumInteger; + } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly + { + get{ return _RequiredNullableEnumIntegerOnly;} + set + { + _RequiredNullableEnumIntegerOnly = value; + _flagRequiredNullableEnumIntegerOnly = true; + } + } + private RequiredNullableEnumIntegerOnlyEnum _RequiredNullableEnumIntegerOnly; + private bool _flagRequiredNullableEnumIntegerOnly; + + /// + /// Returns false as RequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumIntegerOnly() + { + return _flagRequiredNullableEnumIntegerOnly; + } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly + { + get{ return _RequiredNotnullableEnumIntegerOnly;} + set + { + _RequiredNotnullableEnumIntegerOnly = value; + _flagRequiredNotnullableEnumIntegerOnly = true; + } + } + private RequiredNotnullableEnumIntegerOnlyEnum _RequiredNotnullableEnumIntegerOnly; + private bool _flagRequiredNotnullableEnumIntegerOnly; + + /// + /// Returns false as RequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumIntegerOnly() + { + return _flagRequiredNotnullableEnumIntegerOnly; + } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly + { + get{ return _NotrequiredNullableEnumIntegerOnly;} + set + { + _NotrequiredNullableEnumIntegerOnly = value; + _flagNotrequiredNullableEnumIntegerOnly = true; + } + } + private NotrequiredNullableEnumIntegerOnlyEnum? _NotrequiredNullableEnumIntegerOnly; + private bool _flagNotrequiredNullableEnumIntegerOnly; + + /// + /// Returns false as NotrequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumIntegerOnly() + { + return _flagNotrequiredNullableEnumIntegerOnly; + } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly + { + get{ return _NotrequiredNotnullableEnumIntegerOnly;} + set + { + _NotrequiredNotnullableEnumIntegerOnly = value; + _flagNotrequiredNotnullableEnumIntegerOnly = true; + } + } + private NotrequiredNotnullableEnumIntegerOnlyEnum? _NotrequiredNotnullableEnumIntegerOnly; + private bool _flagNotrequiredNotnullableEnumIntegerOnly; + + /// + /// Returns false as NotrequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumIntegerOnly() + { + return _flagNotrequiredNotnullableEnumIntegerOnly; + } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString + { + get{ return _RequiredNotnullableEnumString;} + set + { + _RequiredNotnullableEnumString = value; + _flagRequiredNotnullableEnumString = true; + } + } + private RequiredNotnullableEnumStringEnum _RequiredNotnullableEnumString; + private bool _flagRequiredNotnullableEnumString; + + /// + /// Returns false as RequiredNotnullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumString() + { + return _flagRequiredNotnullableEnumString; + } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString + { + get{ return _RequiredNullableEnumString;} + set + { + _RequiredNullableEnumString = value; + _flagRequiredNullableEnumString = true; + } + } + private RequiredNullableEnumStringEnum _RequiredNullableEnumString; + private bool _flagRequiredNullableEnumString; + + /// + /// Returns false as RequiredNullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumString() + { + return _flagRequiredNullableEnumString; + } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString + { + get{ return _NotrequiredNullableEnumString;} + set + { + _NotrequiredNullableEnumString = value; + _flagNotrequiredNullableEnumString = true; + } + } + private NotrequiredNullableEnumStringEnum? _NotrequiredNullableEnumString; + private bool _flagNotrequiredNullableEnumString; + + /// + /// Returns false as NotrequiredNullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumString() + { + return _flagNotrequiredNullableEnumString; + } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString + { + get{ return _NotrequiredNotnullableEnumString;} + set + { + _NotrequiredNotnullableEnumString = value; + _flagNotrequiredNotnullableEnumString = true; + } + } + private NotrequiredNotnullableEnumStringEnum? _NotrequiredNotnullableEnumString; + private bool _flagNotrequiredNotnullableEnumString; + + /// + /// Returns false as NotrequiredNotnullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumString() + { + return _flagNotrequiredNotnullableEnumString; + } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue + { + get{ return _RequiredNullableOuterEnumDefaultValue;} + set + { + _RequiredNullableOuterEnumDefaultValue = value; + _flagRequiredNullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue _RequiredNullableOuterEnumDefaultValue; + private bool _flagRequiredNullableOuterEnumDefaultValue; + + /// + /// Returns false as RequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableOuterEnumDefaultValue() + { + return _flagRequiredNullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue + { + get{ return _RequiredNotnullableOuterEnumDefaultValue;} + set + { + _RequiredNotnullableOuterEnumDefaultValue = value; + _flagRequiredNotnullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue _RequiredNotnullableOuterEnumDefaultValue; + private bool _flagRequiredNotnullableOuterEnumDefaultValue; + + /// + /// Returns false as RequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableOuterEnumDefaultValue() + { + return _flagRequiredNotnullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue + { + get{ return _NotrequiredNullableOuterEnumDefaultValue;} + set + { + _NotrequiredNullableOuterEnumDefaultValue = value; + _flagNotrequiredNullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue? _NotrequiredNullableOuterEnumDefaultValue; + private bool _flagNotrequiredNullableOuterEnumDefaultValue; + + /// + /// Returns false as NotrequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableOuterEnumDefaultValue() + { + return _flagNotrequiredNullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue + { + get{ return _NotrequiredNotnullableOuterEnumDefaultValue;} + set + { + _NotrequiredNotnullableOuterEnumDefaultValue = value; + _flagNotrequiredNotnullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue? _NotrequiredNotnullableOuterEnumDefaultValue; + private bool _flagNotrequiredNotnullableOuterEnumDefaultValue; + + /// + /// Returns false as NotrequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableOuterEnumDefaultValue() + { + return _flagNotrequiredNotnullableOuterEnumDefaultValue; + } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableIntegerProp = requiredNullableIntegerProp; + this._RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableBooleanProp = requiredNullableBooleanProp; + this._RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableDateProp = requiredNullableDateProp; + this._RequiredNotNullableDateProp = requiredNotNullableDateProp; + this._RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this._RequiredNullableEnumInteger = requiredNullableEnumInteger; + this._RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this._RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this._RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this._RequiredNotnullableEnumString = requiredNotnullableEnumString; + this._RequiredNullableEnumString = requiredNullableEnumString; + this._RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this._RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableUuid = requiredNullableUuid; + this._RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this._RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this._NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + if (this.NotRequiredNullableIntegerProp != null) + { + this._flagNotRequiredNullableIntegerProp = true; + } + this._NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + if (this.NotRequiredNotnullableintegerProp != null) + { + this._flagNotRequiredNotnullableintegerProp = true; + } + this._NotrequiredNullableStringProp = notrequiredNullableStringProp; + if (this.NotrequiredNullableStringProp != null) + { + this._flagNotrequiredNullableStringProp = true; + } + this._NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + if (this.NotrequiredNotnullableStringProp != null) + { + this._flagNotrequiredNotnullableStringProp = true; + } + this._NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + if (this.NotrequiredNullableBooleanProp != null) + { + this._flagNotrequiredNullableBooleanProp = true; + } + this._NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + if (this.NotrequiredNotnullableBooleanProp != null) + { + this._flagNotrequiredNotnullableBooleanProp = true; + } + this._NotRequiredNullableDateProp = notRequiredNullableDateProp; + if (this.NotRequiredNullableDateProp != null) + { + this._flagNotRequiredNullableDateProp = true; + } + this._NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + if (this.NotRequiredNotnullableDateProp != null) + { + this._flagNotRequiredNotnullableDateProp = true; + } + this._NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + if (this.NotrequiredNullableDatetimeProp != null) + { + this._flagNotrequiredNullableDatetimeProp = true; + } + this._NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + if (this.NotrequiredNotnullableDatetimeProp != null) + { + this._flagNotrequiredNotnullableDatetimeProp = true; + } + this._NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + if (this.NotrequiredNullableEnumInteger != null) + { + this._flagNotrequiredNullableEnumInteger = true; + } + this._NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + if (this.NotrequiredNotnullableEnumInteger != null) + { + this._flagNotrequiredNotnullableEnumInteger = true; + } + this._NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + if (this.NotrequiredNullableEnumIntegerOnly != null) + { + this._flagNotrequiredNullableEnumIntegerOnly = true; + } + this._NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + if (this.NotrequiredNotnullableEnumIntegerOnly != null) + { + this._flagNotrequiredNotnullableEnumIntegerOnly = true; + } + this._NotrequiredNullableEnumString = notrequiredNullableEnumString; + if (this.NotrequiredNullableEnumString != null) + { + this._flagNotrequiredNullableEnumString = true; + } + this._NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + if (this.NotrequiredNotnullableEnumString != null) + { + this._flagNotrequiredNotnullableEnumString = true; + } + this._NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + if (this.NotrequiredNullableOuterEnumDefaultValue != null) + { + this._flagNotrequiredNullableOuterEnumDefaultValue = true; + } + this._NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + if (this.NotrequiredNotnullableOuterEnumDefaultValue != null) + { + this._flagNotrequiredNotnullableOuterEnumDefaultValue = true; + } + this._NotrequiredNullableUuid = notrequiredNullableUuid; + if (this.NotrequiredNullableUuid != null) + { + this._flagNotrequiredNullableUuid = true; + } + this._NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + if (this.NotrequiredNotnullableUuid != null) + { + this._flagNotrequiredNotnullableUuid = true; + } + this._NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + if (this.NotrequiredNullableArrayOfString != null) + { + this._flagNotrequiredNullableArrayOfString = true; + } + this._NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + if (this.NotrequiredNotnullableArrayOfString != null) + { + this._flagNotrequiredNotnullableArrayOfString = true; + } + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp + { + get{ return _RequiredNullableIntegerProp;} + set + { + _RequiredNullableIntegerProp = value; + _flagRequiredNullableIntegerProp = true; + } + } + private int? _RequiredNullableIntegerProp; + private bool _flagRequiredNullableIntegerProp; + + /// + /// Returns false as RequiredNullableIntegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableIntegerProp() + { + return _flagRequiredNullableIntegerProp; + } + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp + { + get{ return _RequiredNotnullableintegerProp;} + set + { + _RequiredNotnullableintegerProp = value; + _flagRequiredNotnullableintegerProp = true; + } + } + private int _RequiredNotnullableintegerProp; + private bool _flagRequiredNotnullableintegerProp; + + /// + /// Returns false as RequiredNotnullableintegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableintegerProp() + { + return _flagRequiredNotnullableintegerProp; + } + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp + { + get{ return _NotRequiredNullableIntegerProp;} + set + { + _NotRequiredNullableIntegerProp = value; + _flagNotRequiredNullableIntegerProp = true; + } + } + private int? _NotRequiredNullableIntegerProp; + private bool _flagNotRequiredNullableIntegerProp; + + /// + /// Returns false as NotRequiredNullableIntegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNullableIntegerProp() + { + return _flagNotRequiredNullableIntegerProp; + } + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp + { + get{ return _NotRequiredNotnullableintegerProp;} + set + { + _NotRequiredNotnullableintegerProp = value; + _flagNotRequiredNotnullableintegerProp = true; + } + } + private int _NotRequiredNotnullableintegerProp; + private bool _flagNotRequiredNotnullableintegerProp; + + /// + /// Returns false as NotRequiredNotnullableintegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNotnullableintegerProp() + { + return _flagNotRequiredNotnullableintegerProp; + } + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp + { + get{ return _RequiredNullableStringProp;} + set + { + _RequiredNullableStringProp = value; + _flagRequiredNullableStringProp = true; + } + } + private string _RequiredNullableStringProp; + private bool _flagRequiredNullableStringProp; + + /// + /// Returns false as RequiredNullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableStringProp() + { + return _flagRequiredNullableStringProp; + } + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp + { + get{ return _RequiredNotnullableStringProp;} + set + { + _RequiredNotnullableStringProp = value; + _flagRequiredNotnullableStringProp = true; + } + } + private string _RequiredNotnullableStringProp; + private bool _flagRequiredNotnullableStringProp; + + /// + /// Returns false as RequiredNotnullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableStringProp() + { + return _flagRequiredNotnullableStringProp; + } + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp + { + get{ return _NotrequiredNullableStringProp;} + set + { + _NotrequiredNullableStringProp = value; + _flagNotrequiredNullableStringProp = true; + } + } + private string _NotrequiredNullableStringProp; + private bool _flagNotrequiredNullableStringProp; + + /// + /// Returns false as NotrequiredNullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableStringProp() + { + return _flagNotrequiredNullableStringProp; + } + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp + { + get{ return _NotrequiredNotnullableStringProp;} + set + { + _NotrequiredNotnullableStringProp = value; + _flagNotrequiredNotnullableStringProp = true; + } + } + private string _NotrequiredNotnullableStringProp; + private bool _flagNotrequiredNotnullableStringProp; + + /// + /// Returns false as NotrequiredNotnullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableStringProp() + { + return _flagNotrequiredNotnullableStringProp; + } + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp + { + get{ return _RequiredNullableBooleanProp;} + set + { + _RequiredNullableBooleanProp = value; + _flagRequiredNullableBooleanProp = true; + } + } + private bool? _RequiredNullableBooleanProp; + private bool _flagRequiredNullableBooleanProp; + + /// + /// Returns false as RequiredNullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableBooleanProp() + { + return _flagRequiredNullableBooleanProp; + } + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp + { + get{ return _RequiredNotnullableBooleanProp;} + set + { + _RequiredNotnullableBooleanProp = value; + _flagRequiredNotnullableBooleanProp = true; + } + } + private bool _RequiredNotnullableBooleanProp; + private bool _flagRequiredNotnullableBooleanProp; + + /// + /// Returns false as RequiredNotnullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableBooleanProp() + { + return _flagRequiredNotnullableBooleanProp; + } + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp + { + get{ return _NotrequiredNullableBooleanProp;} + set + { + _NotrequiredNullableBooleanProp = value; + _flagNotrequiredNullableBooleanProp = true; + } + } + private bool? _NotrequiredNullableBooleanProp; + private bool _flagNotrequiredNullableBooleanProp; + + /// + /// Returns false as NotrequiredNullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableBooleanProp() + { + return _flagNotrequiredNullableBooleanProp; + } + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp + { + get{ return _NotrequiredNotnullableBooleanProp;} + set + { + _NotrequiredNotnullableBooleanProp = value; + _flagNotrequiredNotnullableBooleanProp = true; + } + } + private bool _NotrequiredNotnullableBooleanProp; + private bool _flagNotrequiredNotnullableBooleanProp; + + /// + /// Returns false as NotrequiredNotnullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableBooleanProp() + { + return _flagNotrequiredNotnullableBooleanProp; + } + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDateProp + { + get{ return _RequiredNullableDateProp;} + set + { + _RequiredNullableDateProp = value; + _flagRequiredNullableDateProp = true; + } + } + private DateTime? _RequiredNullableDateProp; + private bool _flagRequiredNullableDateProp; + + /// + /// Returns false as RequiredNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableDateProp() + { + return _flagRequiredNullableDateProp; + } + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotNullableDateProp + { + get{ return _RequiredNotNullableDateProp;} + set + { + _RequiredNotNullableDateProp = value; + _flagRequiredNotNullableDateProp = true; + } + } + private DateTime _RequiredNotNullableDateProp; + private bool _flagRequiredNotNullableDateProp; + + /// + /// Returns false as RequiredNotNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotNullableDateProp() + { + return _flagRequiredNotNullableDateProp; + } + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + public DateTime? NotRequiredNullableDateProp + { + get{ return _NotRequiredNullableDateProp;} + set + { + _NotRequiredNullableDateProp = value; + _flagNotRequiredNullableDateProp = true; + } + } + private DateTime? _NotRequiredNullableDateProp; + private bool _flagNotRequiredNullableDateProp; + + /// + /// Returns false as NotRequiredNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNullableDateProp() + { + return _flagNotRequiredNullableDateProp; + } + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + public DateTime NotRequiredNotnullableDateProp + { + get{ return _NotRequiredNotnullableDateProp;} + set + { + _NotRequiredNotnullableDateProp = value; + _flagNotRequiredNotnullableDateProp = true; + } + } + private DateTime _NotRequiredNotnullableDateProp; + private bool _flagNotRequiredNotnullableDateProp; + + /// + /// Returns false as NotRequiredNotnullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNotnullableDateProp() + { + return _flagNotRequiredNotnullableDateProp; + } + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp + { + get{ return _RequiredNotnullableDatetimeProp;} + set + { + _RequiredNotnullableDatetimeProp = value; + _flagRequiredNotnullableDatetimeProp = true; + } + } + private DateTime _RequiredNotnullableDatetimeProp; + private bool _flagRequiredNotnullableDatetimeProp; + + /// + /// Returns false as RequiredNotnullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableDatetimeProp() + { + return _flagRequiredNotnullableDatetimeProp; + } + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp + { + get{ return _RequiredNullableDatetimeProp;} + set + { + _RequiredNullableDatetimeProp = value; + _flagRequiredNullableDatetimeProp = true; + } + } + private DateTime? _RequiredNullableDatetimeProp; + private bool _flagRequiredNullableDatetimeProp; + + /// + /// Returns false as RequiredNullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableDatetimeProp() + { + return _flagRequiredNullableDatetimeProp; + } + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp + { + get{ return _NotrequiredNullableDatetimeProp;} + set + { + _NotrequiredNullableDatetimeProp = value; + _flagNotrequiredNullableDatetimeProp = true; + } + } + private DateTime? _NotrequiredNullableDatetimeProp; + private bool _flagNotrequiredNullableDatetimeProp; + + /// + /// Returns false as NotrequiredNullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableDatetimeProp() + { + return _flagNotrequiredNullableDatetimeProp; + } + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp + { + get{ return _NotrequiredNotnullableDatetimeProp;} + set + { + _NotrequiredNotnullableDatetimeProp = value; + _flagNotrequiredNotnullableDatetimeProp = true; + } + } + private DateTime _NotrequiredNotnullableDatetimeProp; + private bool _flagNotrequiredNotnullableDatetimeProp; + + /// + /// Returns false as NotrequiredNotnullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableDatetimeProp() + { + return _flagNotrequiredNotnullableDatetimeProp; + } + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid + { + get{ return _RequiredNullableUuid;} + set + { + _RequiredNullableUuid = value; + _flagRequiredNullableUuid = true; + } + } + private Guid? _RequiredNullableUuid; + private bool _flagRequiredNullableUuid; + + /// + /// Returns false as RequiredNullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableUuid() + { + return _flagRequiredNullableUuid; + } + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid + { + get{ return _RequiredNotnullableUuid;} + set + { + _RequiredNotnullableUuid = value; + _flagRequiredNotnullableUuid = true; + } + } + private Guid _RequiredNotnullableUuid; + private bool _flagRequiredNotnullableUuid; + + /// + /// Returns false as RequiredNotnullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableUuid() + { + return _flagRequiredNotnullableUuid; + } + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid + { + get{ return _NotrequiredNullableUuid;} + set + { + _NotrequiredNullableUuid = value; + _flagNotrequiredNullableUuid = true; + } + } + private Guid? _NotrequiredNullableUuid; + private bool _flagNotrequiredNullableUuid; + + /// + /// Returns false as NotrequiredNullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableUuid() + { + return _flagNotrequiredNullableUuid; + } + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid + { + get{ return _NotrequiredNotnullableUuid;} + set + { + _NotrequiredNotnullableUuid = value; + _flagNotrequiredNotnullableUuid = true; + } + } + private Guid _NotrequiredNotnullableUuid; + private bool _flagNotrequiredNotnullableUuid; + + /// + /// Returns false as NotrequiredNotnullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableUuid() + { + return _flagNotrequiredNotnullableUuid; + } + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString + { + get{ return _RequiredNullableArrayOfString;} + set + { + _RequiredNullableArrayOfString = value; + _flagRequiredNullableArrayOfString = true; + } + } + private List _RequiredNullableArrayOfString; + private bool _flagRequiredNullableArrayOfString; + + /// + /// Returns false as RequiredNullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableArrayOfString() + { + return _flagRequiredNullableArrayOfString; + } + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString + { + get{ return _RequiredNotnullableArrayOfString;} + set + { + _RequiredNotnullableArrayOfString = value; + _flagRequiredNotnullableArrayOfString = true; + } + } + private List _RequiredNotnullableArrayOfString; + private bool _flagRequiredNotnullableArrayOfString; + + /// + /// Returns false as RequiredNotnullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableArrayOfString() + { + return _flagRequiredNotnullableArrayOfString; + } + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString + { + get{ return _NotrequiredNullableArrayOfString;} + set + { + _NotrequiredNullableArrayOfString = value; + _flagNotrequiredNullableArrayOfString = true; + } + } + private List _NotrequiredNullableArrayOfString; + private bool _flagNotrequiredNullableArrayOfString; + + /// + /// Returns false as NotrequiredNullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableArrayOfString() + { + return _flagNotrequiredNullableArrayOfString; + } + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString + { + get{ return _NotrequiredNotnullableArrayOfString;} + set + { + _NotrequiredNotnullableArrayOfString = value; + _flagNotrequiredNotnullableArrayOfString = true; + } + } + private List _NotrequiredNotnullableArrayOfString; + private bool _flagNotrequiredNotnullableArrayOfString; + + /// + /// Returns false as NotrequiredNotnullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableArrayOfString() + { + return _flagNotrequiredNotnullableArrayOfString; + } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs index 4e25bc4a95cd..81c7a53956c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs @@ -51,7 +51,7 @@ public SerializationTests() [TestMethod] public void Category() { - Category category = new(1, "test"); + Category category = new("test", 1); string categoryJson = JsonSerializer.Serialize(category, _jsonSerializerOptions); Category? category2 = JsonSerializer.Deserialize(categoryJson, _jsonSerializerOptions); Assert.AreEqual(category.Id, category2?.Id); @@ -101,17 +101,14 @@ public void GmFruit() string gmFruitJson = JsonSerializer.Serialize(gmFruit, _jsonSerializerOptions); GmFruit? gmFruit2 = JsonSerializer.Deserialize(gmFruitJson, _jsonSerializerOptions); Assert.IsTrue( - gmFruit.Apple != null && - gmFruit.Banana != null && + gmFruit.Apple.Value != null && + gmFruit.Banana.Value != null && gmFruit2 != null && - gmFruit2.Apple != null && - gmFruit2.Banana != null && - gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && - gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && - gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); - - Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); - Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); + gmFruit2.Apple.Value != null && + gmFruit2.Banana.Value != null && + gmFruit2.Apple.Value.Cultivar.Equals(gmFruit.Apple.Value.Cultivar) && + gmFruit2.Apple.Value.Origin.Equals(gmFruit.Apple.Value.Origin) && + gmFruit2.Banana.Value.LengthCm.Equals(gmFruit.Banana.Value.LengthCm)); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES index 03f61d173609..96f2ef1bc1c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/UseSourceGeneration/Model/PolymorphicProperty.cs src/UseSourceGeneration/Model/Quadrilateral.cs src/UseSourceGeneration/Model/QuadrilateralInterface.cs src/UseSourceGeneration/Model/ReadOnlyFirst.cs +src/UseSourceGeneration/Model/RequiredClass.cs src/UseSourceGeneration/Model/Return.cs src/UseSourceGeneration/Model/RolesReportsHash.cs src/UseSourceGeneration/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md index cebefe7ff377..5127709c28f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md index 49836874e08f..f598aab71491 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md index 33be89a5331b..98fa755fce04 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md index 0c5ac31d7992..ea37536068af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md new file mode 100644 index 000000000000..0051888c2aed --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# UseSourceGeneration.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs index e36737349b7b..aff5eb0b28de 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs index 0a70d3d2f3a8..a30a809a237f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs index 4935820c78d8..a2ab283fc459 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -89,15 +98,6 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs index 3c21562aaf1d..dda0523439cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ public void FormatTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ public void DateTest() // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs index 750f806d61d1..24f0472ce352 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..535d720a770d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using UseSourceGeneration.Model; +using UseSourceGeneration.Client; +using System.Reflection; + +namespace UseSourceGeneration.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs index a4f8e6df40d4..461bb212c25b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs @@ -141,6 +141,8 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -149,8 +151,6 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,6 +167,30 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs index 7a8056ab4da0..a1bc8ed12897 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs @@ -116,6 +116,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); @@ -210,6 +211,7 @@ public HostConfiguration(IServiceCollection services) new QuadrilateralSerializationContext(), new QuadrilateralInterfaceSerializationContext(), new ReadOnlyFirstSerializationContext(), + new RequiredClassSerializationContext(), new ReturnSerializationContext(), new RolesReportsHashSerializationContext(), new RolesReportsHashRoleSerializationContext(), diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs index 93f54baec74c..c713a0416b9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index 21b946eba142..750fb302de38 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -37,7 +37,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs = default) { ActivityOutputs = activityOutputs; OnCreated(); @@ -49,7 +49,7 @@ public Activity(Dictionary> ac /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Option>> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary>? activityOutputs = default; + Option>?> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +131,12 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); + + return new Activity(activityOutputsParsedValue); } /// @@ -161,8 +163,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputs.IsSet) + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index 7d7042c48e51..a5d0b987839c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -38,7 +38,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { Prop1 = prop1; Prop2 = prop2; @@ -51,13 +51,13 @@ public ActivityOutputElementRepresentation(string prop1, Object prop2) /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public Option Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Option Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? prop1 = default; - Object? prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -144,13 +144,16 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + Option prop1ParsedValue = new Option(prop1.Value); + Option prop2ParsedValue = new Option(prop2.Value); + + return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); } /// @@ -177,9 +180,11 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); + if (activityOutputElementRepresentation.Prop2.IsSet) + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index 09b3dd1d2611..ec1c16f445af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -44,7 +44,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -64,49 +64,49 @@ public AdditionalPropertiesClass(Object emptyMap, Dictionary /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Option EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Option>> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Option> MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Option> MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get; set; } + public Option Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -168,14 +168,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object? emptyMap = default; - Dictionary>? mapOfMapProperty = default; - Dictionary? mapProperty = default; - Object? mapWithUndeclaredPropertiesAnytype1 = default; - Object? mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary? mapWithUndeclaredPropertiesString = default; - Object? anytype1 = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -194,35 +194,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -230,28 +230,36 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + Option emptyMapParsedValue = new Option(emptyMap.Value); + Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); + Option> mapPropertyParsedValue = new Option>(mapProperty.Value); + Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); + Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); + Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); + Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); + + return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); } /// @@ -278,22 +286,35 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMap.IsSet) + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapProperty.IsSet) + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapProperty.IsSet) + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1.IsSet) + if (additionalPropertiesClass.Anytype1.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index 6beaaf3e97ce..09e663260160 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -38,7 +38,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; Color = color; @@ -57,7 +57,7 @@ public Animal(string className, string color = @"red") /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -123,8 +123,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - string? color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -142,10 +142,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -153,13 +153,19 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - return new Animal(className, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + string classNameParsedValue = className.Value; + Option colorParsedValue = new Option(color.Value); + + return new Animal(classNameParsedValue, colorParsedValue); } /// @@ -186,8 +192,9 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + writer.WriteString("className", animal.ClassName); + if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index 44f22494b301..d8f266176a94 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -39,7 +39,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { Code = code; Message = message; @@ -53,19 +53,19 @@ public ApiResponse(int code, string message, string type) /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public Option Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public Option Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string? message = default; - string? type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -143,13 +143,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()!); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -157,16 +157,20 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + Option codeParsedValue = new Option(code.Value.Value); + Option messageParsedValue = new Option(message.Value); + Option typeParsedValue = new Option(type.Value); + + return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); } /// @@ -193,9 +197,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); + if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); + if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index f163ab1d0ba5..d04681fc6b76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -39,7 +39,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { ColorCode = colorCode; Cultivar = cultivar; @@ -53,19 +53,19 @@ public Apple(string colorCode, string cultivar, string origin) /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public Option ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public Option Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public Option Origin { get; set; } /// /// Gets or Sets additional properties @@ -96,28 +96,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCode.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.Cultivar.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.Origin.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -149,9 +149,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? colorCode = default; - string? cultivar = default; - string? origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -169,13 +169,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()!); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -183,16 +183,20 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + Option colorCodeParsedValue = new Option(colorCode.Value); + Option cultivarParsedValue = new Option(cultivar.Value); + Option originParsedValue = new Option(origin.Value); + + return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); } /// @@ -219,9 +223,12 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); + if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); + if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index 52d9af2f3611..e7172305c6af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -38,7 +38,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; Mealy = mealy; @@ -57,7 +57,7 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public Option Mealy { get; set; } /// /// Returns the string presentation of the object @@ -106,8 +106,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -125,11 +125,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -137,13 +137,19 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) + if (!cultivar.IsSet) throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + string cultivarParsedValue = cultivar.Value; + Option mealyParsedValue = new Option(mealy.Value.Value); + + return new AppleReq(cultivarParsedValue, mealyParsedValue); } /// @@ -170,8 +176,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + writer.WriteString("cultivar", appleReq.Cultivar); + if (appleReq.Mealy.IsSet) + writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index 96905a9ad00d..c23c004c1310 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -37,7 +37,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -49,7 +49,7 @@ public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public Option>> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayNumber = default; + Option>?> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +131,12 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); } /// @@ -161,8 +163,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 2fc3f9aa15b3..43ac4fb02974 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -37,7 +37,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { ArrayNumber = arrayNumber; OnCreated(); @@ -49,7 +49,7 @@ public ArrayOfNumberOnly(List arrayNumber) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public Option> ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayNumber = default; + Option?> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +131,12 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); + + return new ArrayOfNumberOnly(arrayNumberParsedValue); } /// @@ -161,8 +163,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumber.IsSet) + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 5923398e2cac..8a7934d7e994 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -39,7 +39,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -53,19 +53,19 @@ public ArrayTest(List> arrayArrayOfInteger, List> /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public Option>> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public Option>> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public Option> ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayOfInteger = default; - List>? arrayArrayOfModel = default; - List? arrayOfString = default; + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -143,15 +143,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -159,16 +159,20 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); + Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); + Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); + + return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); } /// @@ -195,12 +199,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfInteger.IsSet) + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModel.IsSet) + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfString.IsSet) + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs index 5528e531ea89..dd74c782e30b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs @@ -37,7 +37,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { LengthCm = lengthCm; OnCreated(); @@ -49,7 +49,7 @@ public Banana(decimal lengthCm) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public Option LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -131,10 +131,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + Option lengthCmParsedValue = new Option(lengthCm.Value.Value); + + return new Banana(lengthCmParsedValue); } /// @@ -161,7 +163,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCm.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCm.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index 7b5186114050..398381570349 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -38,7 +38,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; Sweet = sweet; @@ -57,7 +57,7 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public Option Sweet { get; set; } /// /// Returns the string presentation of the object @@ -106,8 +106,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -126,11 +126,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -138,13 +138,19 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) + if (!lengthCm.IsSet) throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + decimal lengthCmParsedValue = lengthCm.Value.Value; + Option sweetParsedValue = new Option(sweet.Value.Value); + + return new BananaReq(lengthCmParsedValue, sweetParsedValue); } /// @@ -171,8 +177,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + if (bananaReq.Sweet.IsSet) + writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs index 4721383c8969..36b2475b5048 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs @@ -104,7 +104,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,15 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - return new BasquePig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + string classNameParsedValue = className.Value; + + return new BasquePig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index b0cc3ec0d597..8e01699cdd38 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -42,7 +42,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -60,37 +60,37 @@ public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public Option ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public Option CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public Option CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public Option SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public Option SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public Option SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -150,12 +150,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? aTTNAME = default; - string? capitalCamel = default; - string? capitalSnake = default; - string? sCAETHFlowPoints = default; - string? smallCamel = default; - string? smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -173,22 +173,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()!); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()!); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()!); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()!); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,25 +196,32 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + Option aTTNAMEParsedValue = new Option(aTTNAME.Value); + Option capitalCamelParsedValue = new Option(capitalCamel.Value); + Option capitalSnakeParsedValue = new Option(capitalSnake.Value); + Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); + Option smallCamelParsedValue = new Option(smallCamel.Value); + Option smallSnakeParsedValue = new Option(smallSnake.Value); + + return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); } /// @@ -241,12 +248,18 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); + if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); + if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); + if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); + if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); + if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index 9535772c5069..80f8dacff01b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -39,7 +39,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { Declawed = declawed; OnCreated(); @@ -51,7 +51,7 @@ public Cat(string className, bool declawed, string color = @"red") : base(classN /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public Option Declawed { get; set; } /// /// Returns the string presentation of the object @@ -90,9 +90,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? declawed = default; - string? color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -110,14 +110,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -125,16 +125,23 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + string classNameParsedValue = className.Value; + Option declawedParsedValue = new Option(declawed.Value.Value); + Option colorParsedValue = new Option(color.Value); + + return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); } /// @@ -161,9 +168,11 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + writer.WriteString("className", cat.ClassName); + if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); + if (cat.Color.IsSet) + writer.WriteString("color", cat.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 1c1133055c7c..fcd75a7f5dea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -35,30 +35,30 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + Id = id; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } - /// /// Gets or Sets Name /// [JsonPropertyName("name")] public string Name { get; set; } + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets additional properties /// @@ -73,8 +73,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -113,8 +113,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -131,12 +131,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -144,13 +144,19 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - return new Category(id.Value, name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + string nameParsedValue = name.Value; + Option idParsedValue = new Option(id.Value.Value); + + return new Category(nameParsedValue, idParsedValue); } /// @@ -177,8 +183,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + writer.WriteString("name", category.Name); + if (category.Id.IsSet) + writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index 7ef472d82939..ed687584e291 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -38,7 +38,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { Name = name; PetType = petType; @@ -103,13 +103,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new Option PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Returns the string presentation of the object @@ -149,8 +149,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -168,13 +168,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -182,13 +181,16 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + Option nameParsedValue = new Option(name.Value); + Option petTypeParsedValue = new Option(petType.Value.Value); + + return new ChildCat(nameParsedValue, petTypeParsedValue); } /// @@ -215,9 +217,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); - - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index af9e0c3d1c52..c88798083b0c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -37,7 +37,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { VarClass = varClass; OnCreated(); @@ -49,7 +49,7 @@ public ClassModel(string varClass) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + Option varClassParsedValue = new Option(varClass.Value); + + return new ClassModel(varClassParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClass.IsSet) + writer.WriteString("_class", classModel.VarClass.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index 3d57316efa89..b47fe8777c83 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -113,8 +113,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,22 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -176,8 +185,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs index 8734f04bad7e..ecb6dab05823 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs @@ -104,7 +104,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,15 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - return new DanishPig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + string classNameParsedValue = className.Value; + + return new DanishPig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index bd4801d771cb..8587afc4783a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -37,7 +37,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -50,7 +50,7 @@ public DateOnlyClass(DateTime dateOnlyProperty) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public Option DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -110,7 +110,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +129,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -137,10 +137,12 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); + + return new DateOnlyClass(dateOnlyPropertyParsedValue); } /// @@ -167,7 +169,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyProperty.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index 1783c3add71c..232c363f041c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -37,7 +37,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { Name = name; OnCreated(); @@ -49,7 +49,7 @@ public DeprecatedObject(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + Option nameParsedValue = new Option(name.Value); + + return new DeprecatedObject(nameParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.Name.IsSet) + writer.WriteString("name", deprecatedObject.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index 70beb60686ba..f65ddf23da5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -35,11 +35,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { Breed = breed; OnCreated(); @@ -51,7 +51,7 @@ public Dog(string breed, string className, string color = @"red") : base(classNa /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public Option Breed { get; set; } /// /// Returns the string presentation of the object @@ -90,9 +90,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? breed = default; - string? className = default; - string? color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -109,14 +109,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -124,16 +124,23 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + string classNameParsedValue = className.Value; + Option breedParsedValue = new Option(breed.Value); + Option colorParsedValue = new Option(color.Value); - return new Dog(breed, className, color); + return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); } /// @@ -160,9 +167,11 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + writer.WriteString("className", dog.ClassName); + if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); + if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index 955f0571e1d9..04e1cce6dfec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -40,7 +40,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -55,25 +55,25 @@ public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Option MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public Option> Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get; set; } + public Option NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get; set; } + public Option ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -142,10 +142,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape? mainShape = default; - List? shapes = default; - NullableShape? nullableShape = default; - ShapeOrNull? shapeOrNull = default; + Option mainShape = default; + Option?> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -164,19 +164,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -184,13 +184,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + Option mainShapeParsedValue = new Option(mainShape.Value); + Option> shapesParsedValue = new Option>(shapes.Value); + + return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); } /// @@ -217,14 +220,28 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShape.IsSet) + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.Shapes.IsSet) + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShape.IsSet) + if (drawing.NullableShape.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNull.IsSet) + if (drawing.ShapeOrNull.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index b450ddadfb17..5145baec174f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -38,7 +38,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -183,13 +183,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public Option JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public Option> ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -245,8 +245,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option?> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -265,13 +265,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -279,13 +278,16 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); + Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + + return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); } /// @@ -312,10 +314,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnum.IsSet) + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index 88fa5ff18a16..6037e0c9c625 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -35,23 +35,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { + EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; - EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -61,6 +61,162 @@ public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// @@ -124,7 +280,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public Option EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -189,7 +345,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public Option EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -261,7 +417,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public Option EnumNumber { get; set; } /// /// Defines EnumString @@ -417,187 +573,31 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } - - /// - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + public Option EnumString { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + public Option OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + public Option OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + public Option OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public Option OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -613,11 +613,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -660,15 +660,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -685,53 +685,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -739,31 +733,43 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; + Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); + Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); + Option enumNumberParsedValue = new Option(enumNumber.Value.Value); + Option enumStringParsedValue = new Option(enumString.Value.Value); + Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); + Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); + Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); + + return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); } /// @@ -790,44 +796,47 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); + if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); + if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else - writer.WriteNull("outerEnumDefaultValue"); - - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + writer.WriteNull("enum_string"); - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); - else + if (enumTest.OuterEnumDefaultValue.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumInteger.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValue.IsSet) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnum.IsSet) + if (enumTest.OuterEnum.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index b161cd58e182..ed4456f8b45c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -113,8 +113,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,22 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -176,8 +185,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index bc7f05fae9e0..5cbe0c075f35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -37,7 +37,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { SourceURI = sourceURI; OnCreated(); @@ -50,7 +50,7 @@ public File(string sourceURI) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public Option SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -105,7 +105,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -131,10 +131,12 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + Option sourceURIParsedValue = new Option(sourceURI.Value); + + return new File(sourceURIParsedValue); } /// @@ -161,7 +163,8 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURI.IsSet) + writer.WriteString("sourceURI", file.SourceURI.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index 68d2af61dbc1..4dad3140081c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -38,7 +38,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option> files = default) { File = file; Files = files; @@ -51,13 +51,13 @@ public FileSchemaTestClass(File file, List files) /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public Option File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public Option> Files { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File? file = default; - List? files = default; + Option file = default; + Option?> files = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -145,13 +145,16 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + Option fileParsedValue = new Option(file.Value); + Option> filesParsedValue = new Option>(files.Value); + + return new FileSchemaTestClass(fileParsedValue, filesParsedValue); } /// @@ -178,10 +181,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.File.IsSet) + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.Files.IsSet) + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index dbedd34f861d..d73e09e6bbba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -37,7 +37,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { Bar = bar; OnCreated(); @@ -49,7 +49,7 @@ public Foo(string bar = @"bar") /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public Option Bar { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + Option barParsedValue = new Option(bar.Value); + + return new Foo(barParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.Bar.IsSet) + writer.WriteString("bar", foo.Bar.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index dabc1bd83dbf..2ad6b7c70b83 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -37,7 +37,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { VarString = varString; OnCreated(); @@ -49,7 +49,7 @@ public FooGetDefaultResponse(Foo varString) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo? varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +131,12 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + Option varStringParsedValue = new Option(varString.Value); + + return new FooGetDefaultResponse(varStringParsedValue); } /// @@ -161,8 +163,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarString.IsSet) + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index d45a83b0f1d7..fe195993bbb3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -35,9 +35,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -45,8 +47,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -55,11 +55,13 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; + Number = number; + Password = password; + Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -67,8 +69,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi Int32 = int32; Int64 = int64; Integer = integer; - Number = number; - Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -81,12 +81,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// @@ -100,106 +94,112 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi [JsonPropertyName("date")] public DateTime Date { get; set; } + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public Option Binary { get; set; } + /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public Option VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public Option VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public Option VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public Option Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public Option Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int Integer { get; set; } - - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } + public Option Integer { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public Option PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public Option PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public Option PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public Option UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public Option UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -215,9 +215,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -225,8 +227,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -246,122 +246,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32.IsSet && this.Int32.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32.IsSet && this.Int32.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.Integer.IsSet && this.Integer.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.Integer.IsSet && this.Integer.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslash.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigits.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiter.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarString.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -402,25 +402,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream? binary = default; - byte[]? varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string? password = default; - string? patternWithBackslash = default; - string? patternWithDigits = default; - string? patternWithDigitsAndDelimiter = default; - string? varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -437,76 +437,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -514,64 +514,96 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - - if (varByte == null) + if (!varByte.IsSet) throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (date == null) + if (!date.IsSet) throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + byte[] varByteParsedValue = varByte.Value; + DateTime dateParsedValue = date.Value.Value; + decimal numberParsedValue = number.Value.Value; + string passwordParsedValue = password.Value; + Option binaryParsedValue = new Option(binary.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option varDecimalParsedValue = new Option(varDecimal.Value.Value); + Option varDoubleParsedValue = new Option(varDouble.Value.Value); + Option varFloatParsedValue = new Option(varFloat.Value.Value); + Option int32ParsedValue = new Option(int32.Value.Value); + Option int64ParsedValue = new Option(int64.Value.Value); + Option integerParsedValue = new Option(integer.Value.Value); + Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); + Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); + Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); + Option varStringParsedValue = new Option(varString.Value); + Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); + Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); } /// @@ -598,28 +630,43 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + if (formatTest.Binary.IsSet) + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); + if (formatTest.VarDecimal.IsSet) + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); + if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); + if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); + if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); + if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); + if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); + if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); + if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); + if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); + if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); + if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); + if (formatTest.Uuid.IsSet) + writer.WriteString("uuid", formatTest.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index be945563eba9..918b7391483a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -37,7 +37,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; Color = color; @@ -49,7 +49,7 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; Color = color; @@ -72,7 +72,7 @@ public Fruit(Banana banana, string color) /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -120,7 +120,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -160,7 +160,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -168,14 +168,16 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option colorParsedValue = new Option(color.Value); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, colorParsedValue); if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, colorParsedValue); throw new JsonException(); } @@ -204,7 +206,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index fea0b966137f..461d363535ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -38,7 +38,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple? apple, Banana? banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { Apple = apple; Banana = banana; @@ -51,18 +51,18 @@ public GmFruit(Apple? apple, Banana? banana, string color) /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Option Apple { get; set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Option Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -110,7 +110,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -150,7 +150,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -158,10 +158,15 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option colorParsedValue = new Option(color.Value); + + Option appleParsedValue = new Option(apple); + Option bananaParsedValue = new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); } /// @@ -175,16 +180,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -200,7 +205,8 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.Color.IsSet) + writer.WriteString("color", gmFruit.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs index d4a0752699b2..9815d17c0ea9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs @@ -114,7 +114,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -132,7 +132,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -140,10 +140,15 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - return new GrandparentAnimal(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + string petTypeParsedValue = petType.Value; + + return new GrandparentAnimal(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index 0ba58633d833..a8f27b64f352 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -38,7 +38,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { Bar = bar; Foo = foo; @@ -51,13 +51,13 @@ internal HasOnlyReadOnly(string bar, string foo) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public Option Foo { get; } /// /// Gets or Sets additional properties @@ -150,8 +150,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -169,10 +169,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -180,13 +180,16 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + Option barParsedValue = new Option(bar.Value); + Option fooParsedValue = new Option(foo.Value); + + return new HasOnlyReadOnly(barParsedValue, fooParsedValue); } /// @@ -213,8 +216,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); + if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs index b0753cea2a42..858556af56ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs @@ -37,7 +37,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string? nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -49,7 +49,7 @@ public HealthCheckResult(string? nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get; set; } + public Option NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -157,7 +157,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessage.IsSet) + if (healthCheckResult.NullableMessage.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); + else + writer.WriteNull("NullableMessage"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index e54fa76f0663..b5aca49756b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -106,8 +106,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -125,10 +125,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -136,13 +136,22 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -169,8 +178,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index 031e16c39a57..3b8cfbc2cd49 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -37,7 +37,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { Var123List = var123List; OnCreated(); @@ -49,7 +49,7 @@ public List(string var123List) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public Option Var123List { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + Option var123ListParsedValue = new Option(var123List.Value); + + return new List(var123ListParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123List.IsSet) + writer.WriteString("123-list", list.Var123List.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 46ae1dc05ae3..4f1d4af301eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -38,7 +38,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -51,13 +51,13 @@ public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public Option EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public Option UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? escapedLiteralString = default; - string? unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()!); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,16 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); + Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); + + return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); } /// @@ -176,8 +179,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); + if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs index fcc1424f2c19..332afa725dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs @@ -154,7 +154,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; Pig? pig = null; Whale? whale = null; @@ -211,7 +211,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -219,17 +219,22 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + string classNameParsedValue = className.Value; + if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, classNameParsedValue); if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, classNameParsedValue); if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index 6ed69e85cf4a..2fb12a9ee52e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -40,7 +40,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { DirectMap = directMap; IndirectMap = indirectMap; @@ -121,25 +121,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Option> DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Option> IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Option>> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Option> MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -197,10 +197,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary? directMap = default; - Dictionary? indirectMap = default; - Dictionary>? mapMapOfString = default; - Dictionary? mapOfEnumString = default; + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -219,19 +219,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -239,19 +239,24 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + Option> directMapParsedValue = new Option>(directMap.Value); + Option> indirectMapParsedValue = new Option>(indirectMap.Value); + Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); + Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + + return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); } /// @@ -278,14 +283,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMap.IsSet) + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMap.IsSet) + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfString.IsSet) + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumString.IsSet) + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 25ea1076cd59..502b99542df1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -40,7 +40,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { DateTime = dateTime; Map = map; @@ -55,25 +55,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Option> Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Option UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -107,7 +107,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -142,10 +142,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary? map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -164,19 +164,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -184,19 +184,24 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option> mapParsedValue = new Option>(map.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); + Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); } /// @@ -223,11 +228,15 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); + if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index 74f7acb1e828..b477d39c62a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -38,7 +38,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { VarClass = varClass; Name = name; @@ -51,13 +51,13 @@ public Model200Response(string varClass, int name) /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -144,13 +144,16 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + Option varClassParsedValue = new Option(varClass.Value); + Option nameParsedValue = new Option(name.Value.Value); + + return new Model200Response(varClassParsedValue, nameParsedValue); } /// @@ -177,8 +180,10 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); + if (model200Response.Name.IsSet) + writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index 5bc60589f350..bb34f93835f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -37,7 +37,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { VarClient = varClient; OnCreated(); @@ -49,7 +49,7 @@ public ModelClient(string varClient) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public Option VarClient { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + Option varClientParsedValue = new Option(varClient.Value); + + return new ModelClient(varClientParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClient.IsSet) + writer.WriteString("client", modelClient.VarClient.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 4648cf04f7d2..3f573d0d57a4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -40,7 +40,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; Property = property; @@ -61,19 +61,19 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public Option Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public Option SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public Option Var123Number { get; } /// /// Gets or Sets additional properties @@ -168,10 +168,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string? property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -190,18 +190,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -209,19 +209,27 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) + if (!varName.IsSet) throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + if (var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + int varNameParsedValue = varName.Value.Value; + Option propertyParsedValue = new Option(property.Value); + Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); + Option var123NumberParsedValue = new Option(var123Number.Value.Value); + + return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); } /// @@ -248,10 +256,13 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + writer.WriteNumber("name", name.VarName); + if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); + if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); + if (name.Var123Number.IsSet) + writer.WriteNumber("123Number", name.Var123Number.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ed43ab9fcd27..92586f0e408f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -113,8 +113,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -145,13 +145,22 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) + if (!aObjVariableobject.IsSet) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (pkiNotificationtestID == null) + if (!pkiNotificationtestID.IsSet) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + List> aObjVariableobjectParsedValue = aObjVariableobject.Value; + int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 5374e7a890e8..53d3770d3674 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -48,7 +48,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -71,73 +71,73 @@ public NullableClass(List arrayItemsNullable, Dictionary /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public Option> ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Option> ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get; set; } + public Option?> ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get; set; } + public Option?> ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public Option BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public Option DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public Option DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public Option IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public Option NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get; set; } + public Option?> ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get; set; } + public Option?> ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get; set; } + public Option StringProp { get; set; } /// /// Gets or Sets additional properties @@ -224,18 +224,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayItemsNullable = default; - Dictionary? objectItemsNullable = default; - List? arrayAndItemsNullableProp = default; - List? arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary? objectAndItemsNullableProp = default; - Dictionary? objectNullableProp = default; - string? stringProp = default; + Option?> arrayItemsNullable = default; + Option?> objectItemsNullable = default; + Option?> arrayAndItemsNullableProp = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -254,50 +254,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -305,13 +305,16 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); + Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); + + return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -338,45 +341,74 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullable.IsSet) + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullable.IsSet) + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullableProp.IsSet) + if (nullableClass.ArrayAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullableProp.IsSet) + if (nullableClass.ArrayNullableProp.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); + if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); + if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); + if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.ObjectAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullableProp.IsSet) + if (nullableClass.ObjectNullableProp.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else + writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs index eb5434dc5ba1..d877f7e61019 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs @@ -37,7 +37,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { Uuid = uuid; OnCreated(); @@ -50,7 +50,7 @@ public NullableGuidClass(Guid? uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -105,7 +105,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -124,7 +124,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -159,11 +159,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.Uuid.IsSet) + if (nullableGuidClass.Uuid.Value != null) + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); + else + writer.WriteNull("uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs index 8a1f0995af65..d647fa2b7d6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs @@ -137,7 +137,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,19 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs index 740f496eb9d7..71d5a3b8016b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs @@ -37,7 +37,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { JustNumber = justNumber; OnCreated(); @@ -49,7 +49,7 @@ public NumberOnly(decimal justNumber) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public Option JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -131,10 +131,12 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + Option justNumberParsedValue = new Option(justNumber.Value.Value); + + return new NumberOnly(justNumberParsedValue); } /// @@ -161,7 +163,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumber.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index 729b057bdb4e..e4efafb6b799 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -40,7 +40,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -56,27 +56,27 @@ public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecated /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public Option> Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public Option DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -134,10 +134,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? bars = default; - DeprecatedObject? deprecatedRef = default; - decimal? id = default; - string? uuid = default; + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -156,18 +156,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -175,19 +175,24 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + Option> barsParsedValue = new Option>(bars.Value); + Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); + Option idParsedValue = new Option(id.Value.Value); + Option uuidParsedValue = new Option(uuid.Value); + + return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); } /// @@ -214,12 +219,16 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.Bars.IsSet) + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRef.IsSet) + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); + if (objectWithDeprecatedFields.Uuid.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index add01056906b..b330f0fb1ec9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -42,7 +42,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { Id = id; PetId = petId; @@ -141,38 +141,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public Option PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public Option Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public Option ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public Option Complete { get; set; } /// /// Gets or Sets additional properties @@ -237,12 +237,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -261,29 +261,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -291,25 +290,32 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + Option idParsedValue = new Option(id.Value.Value); + Option petIdParsedValue = new Option(petId.Value.Value); + Option quantityParsedValue = new Option(quantity.Value.Value); + Option shipDateParsedValue = new Option(shipDate.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option completeParsedValue = new Option(complete.Value.Value); + + return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); } /// @@ -336,18 +342,22 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); - - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); + if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); + if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); + if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); + var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.Complete.IsSet) + writer.WriteBoolean("complete", order.Complete.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index 87526afade06..d6a205be554f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -39,7 +39,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -53,19 +53,19 @@ public OuterComposite(bool myBoolean, decimal myNumber, string myString) /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public Option MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public Option MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public Option MyString { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string? myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -143,14 +143,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -158,16 +158,20 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + Option myBooleanParsedValue = new Option(myBoolean.Value.Value); + Option myNumberParsedValue = new Option(myNumber.Value.Value); + Option myStringParsedValue = new Option(myString.Value); + + return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); } /// @@ -194,9 +198,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); + if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); + if (outerComposite.MyString.IsSet) + writer.WriteString("my_string", outerComposite.MyString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs index 1162f9a2a32d..fe10e7c16e4d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs @@ -80,7 +80,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -98,7 +98,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -106,10 +106,15 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - return new ParentPet(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + string petTypeParsedValue = petType.Value; + + return new ParentPet(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index e012ef64c9cb..ac7334b75eb5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -35,19 +35,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; + Category = category; + Id = id; Status = status; Tags = tags; OnCreated(); @@ -141,19 +141,7 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } - - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Category Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Name @@ -168,11 +156,23 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Option Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public Option> Tags { get; set; } /// /// Gets or Sets additional properties @@ -188,10 +188,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -232,12 +232,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category? category = default; - long? id = default; - string? name = default; - List? photoUrls = default; - Pet.StatusEnum? status = default; - List? tags = default; + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; while (utf8JsonReader.Read()) { @@ -254,30 +254,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()!); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -285,25 +284,38 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (photoUrls == null) + if (!photoUrls.IsSet) throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + if (category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + string nameParsedValue = name.Value; + List photoUrlsParsedValue = photoUrls.Value; + Option categoryParsedValue = new Option(category.Value); + Option idParsedValue = new Option(id.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option> tagsParsedValue = new Option>(tags.Value); + + return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); } /// @@ -330,21 +342,23 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.Category.IsSet) + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.Tags.IsSet) + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs index 3f9fdf20cd85..373e07af5c17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs @@ -137,7 +137,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -188,7 +188,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,19 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + string classNameParsedValue = className.Value; + if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, classNameParsedValue); if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs index 8b6c244ab73d..90f06442f510 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs @@ -137,7 +137,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -188,7 +188,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,19 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs index 91f6a55eb207..f5be5a54e6ec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs @@ -104,7 +104,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,15 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + + return new QuadrilateralInterface(quadrilateralTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index 5ecf54003200..5401ebf74664 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -38,7 +38,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { Bar = bar; Baz = baz; @@ -51,13 +51,13 @@ public ReadOnlyFirst(string bar, string baz) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public Option Baz { get; set; } /// /// Gets or Sets additional properties @@ -149,8 +149,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -168,10 +168,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -179,13 +179,16 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + Option barParsedValue = new Option(bar.Value); + Option bazParsedValue = new Option(baz.Value); + + return new ReadOnlyFirst(barParsedValue, bazParsedValue); } /// @@ -212,8 +215,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); + if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs new file mode 100644 index 000000000000..879d94370323 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -0,0 +1,2231 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = UseSourceGeneration.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using UseSourceGeneration.Client; + +namespace UseSourceGeneration.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDateProp = notRequiredNullableDateProp; + NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumString = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringProp = notrequiredNullableStringProp; + NotrequiredNullableUuid = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public Option NotrequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public Option NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public Option NotrequiredNullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public Option NotrequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public Option NotrequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public Option NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public Option NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public Option> NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public Option NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public Option NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public Option NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Option NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public Option NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public Option NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public Option?> NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public Option NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public Option NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public Option NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Option NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + + if (requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; + List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; + bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; + DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; + RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; + OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; + string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; + Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; + int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; + Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); + Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); + Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); + Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); + Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); + Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); + Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); + Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); + Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); + Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); + Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); + List? requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; + bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; + DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; + DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; + RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; + RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; + RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; + int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; + OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; + string? requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; + Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; + + return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); + if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); + if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); + if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); + if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); + if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNullableArrayOfString.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); + if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } + + /// + /// The RequiredClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RequiredClass))] + public partial class RequiredClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs index 454e16dd0f52..4b0ce0f7f110 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs @@ -37,7 +37,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { VarReturn = varReturn; OnCreated(); @@ -49,7 +49,7 @@ public Return(int varReturn) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public Option VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -131,10 +131,12 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + Option varReturnParsedValue = new Option(varReturn.Value.Value); + + return new Return(varReturnParsedValue); } /// @@ -161,7 +163,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturn.IsSet) + writer.WriteNumber("return", varReturn.VarReturn.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index 3485ce95577c..1c0423b6f186 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -38,7 +38,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { Role = role; RoleUuid = roleUuid; @@ -51,13 +51,13 @@ public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public Option Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Option RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole? role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -145,13 +145,16 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + Option roleParsedValue = new Option(role.Value); + Option roleUuidParsedValue = new Option(roleUuid.Value.Value); + + return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); } /// @@ -178,9 +181,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.Role.IsSet) + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuid.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 9c20ab46bad7..2bcf1d4558e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -37,7 +37,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { Name = name; OnCreated(); @@ -49,7 +49,7 @@ public RolesReportsHashRole(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + Option nameParsedValue = new Option(name.Value); + + return new RolesReportsHashRole(nameParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.Name.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index 39f7d8cc72f2..d5c64c20b379 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -113,8 +113,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,22 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -176,8 +185,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs index 7100b878d3bd..b94a031027f9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs @@ -137,7 +137,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,19 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs index 0a994154af08..f67927f922cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs @@ -104,7 +104,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,15 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - return new ShapeInterface(shapeType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + string shapeTypeParsedValue = shapeType.Value; + + return new ShapeInterface(shapeTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs index c0b313a2f362..33d369e1fe47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs @@ -137,7 +137,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,19 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index c41dcdc9dcf6..42eb7292b720 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -113,8 +113,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,22 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -176,8 +185,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 06b9d48e4696..456b9d7d397b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -38,7 +38,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -51,13 +51,13 @@ public SpecialModelName(string varSpecialModelName, long specialPropertyName) /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public Option VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public Option SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -144,13 +144,16 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); + Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); + + return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); } /// @@ -177,8 +180,10 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); + if (specialModelName.SpecialPropertyName.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index 1bf8c4ad9a0b..25d118a72597 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -38,7 +38,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { Id = id; Name = name; @@ -51,13 +51,13 @@ public Tag(long id, string name) /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -133,10 +133,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -144,13 +144,16 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + Option idParsedValue = new Option(id.Value.Value); + Option nameParsedValue = new Option(name.Value); + + return new Tag(idParsedValue, nameParsedValue); } /// @@ -177,8 +180,10 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); + if (tag.Name.IsSet) + writer.WriteString("name", tag.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index 4249ff2fb47b..1bc93e12e0af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -37,7 +37,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { Value = value; OnCreated(); @@ -49,7 +49,7 @@ public TestCollectionEndingWithWordList(string value) /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public Option Value { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,12 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + Option valueParsedValue = new Option(value.Value); + + return new TestCollectionEndingWithWordList(valueParsedValue); } /// @@ -160,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.Value.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index ed130760a758..36e7b5632583 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -37,7 +37,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -49,7 +49,7 @@ public TestCollectionEndingWithWordListObject(List [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public Option> TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? testCollectionEndingWithWordList = default; + Option?> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +131,12 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); } /// @@ -161,8 +163,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index dd3c3ec026a0..278edcd2fbbe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -37,7 +37,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { SomeProperty = someProperty; OnCreated(); @@ -49,7 +49,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public Option SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -115,7 +115,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -133,7 +133,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,10 +141,12 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + Option somePropertyParsedValue = new Option(someProperty.Value); + + return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); } /// @@ -171,7 +173,8 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs index bddcf663a293..c15d4f77ab67 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs @@ -154,7 +154,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -211,7 +211,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -219,17 +219,22 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + string triangleTypeParsedValue = triangleType.Value; + if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleTypeParsedValue); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleTypeParsedValue); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs index adc70c646cb9..45443f13dac8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs @@ -104,7 +104,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,15 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - return new TriangleInterface(triangleType); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + string triangleTypeParsedValue = triangleType.Value; + + return new TriangleInterface(triangleTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 684c3ff5a2e0..6b183800d869 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -48,7 +48,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -71,78 +71,78 @@ public User(string email, string firstName, long id, string lastName, Object obj /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public Option Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public Option FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public Option LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Option ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public Option Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public Option Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public Option UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public Option Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get; set; } + public Option AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get; set; } + public Option AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get; set; } + public Option ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -208,18 +208,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? email = default; - string? firstName = default; - long? id = default; - string? lastName = default; - Object? objectWithNoDeclaredProps = default; - string? password = default; - string? phone = default; - int? userStatus = default; - string? username = default; - Object? anyTypeProp = default; - Object? anyTypePropNullable = default; - Object? objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -237,46 +237,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()!); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()!); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -284,34 +284,44 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + Option emailParsedValue = new Option(email.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option idParsedValue = new Option(id.Value.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); + Option passwordParsedValue = new Option(password.Value); + Option phoneParsedValue = new Option(phone.Value); + Option userStatusParsedValue = new Option(userStatus.Value.Value); + Option usernameParsedValue = new Option(username.Value); + + return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -338,22 +348,49 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); + if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); + if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); + if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); + if (user.ObjectWithNoDeclaredProps.IsSet) + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); + if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); + if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); + if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); + if (user.AnyTypeProp.IsSet) + if (user.AnyTypeProp.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullable.IsSet) + if (user.AnyTypePropNullable.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullable.IsSet) + if (user.ObjectWithNoDeclaredPropsNullable.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index 7d320ced8bb2..2b0496853cef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -39,7 +39,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; HasBaleen = hasBaleen; @@ -59,13 +59,13 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public Option HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public Option HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -142,15 +142,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -158,16 +158,23 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + if (hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + string classNameParsedValue = className.Value; + Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); + Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); + + return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); } /// @@ -194,9 +201,11 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + writer.WriteString("className", whale.ClassName); + if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); + if (whale.HasTeeth.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 6e1c25bb5df0..808fd31844c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -38,7 +38,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; Type = type; @@ -131,7 +131,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets ClassName @@ -204,8 +204,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -223,13 +223,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -237,13 +236,19 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + string classNameParsedValue = className.Value; + Option typeParsedValue = new Option(type.Value.Value); + + return new Zebra(classNameParsedValue, typeParsedValue); } /// @@ -270,9 +275,8 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); - - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + writer.WriteString("className", zebra.ClassName); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index e8e474a4a69f..44b71de59c32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -37,7 +37,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -115,7 +115,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public Option ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -170,7 +170,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -189,9 +189,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -199,10 +198,12 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + + return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); } /// @@ -229,8 +230,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index e4a94d4e6e21..a80063846632 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -47,7 +47,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] public Option DateOnlyProperty { get; set; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 539a83d6d5ac..395988c3f931 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -89,7 +89,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index 1a33b872facc..05a82fc1e0ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -969,6 +969,7 @@ public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromS { if (value == null) return null; + if (value == RequiredNullableEnumStringEnum.UPPER) return "UPPER"; @@ -1263,6 +1264,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu { if (value == null) return null; + if (value == NotrequiredNullableEnumStringEnum.UPPER) return "UPPER"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 6c82be59af88..62a5cdba43b7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index 7fe8f333c81a..b78fc06d07c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f428662..bfec38903066 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -89,15 +98,6 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af78..164baa8862be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ public void FormatTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ public void DateTest() // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faad..8485d1213ce6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..6e8958b1b749 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index ee025fa27f60..d446614772f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -139,6 +139,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -147,8 +149,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -165,6 +165,30 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5ea9415eba07..0cd32640adfe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,6 +114,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs index 70f41078bb68..34653363aacf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,5 +35,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 42747dee35ea..7cca29511188 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs = default) { ActivityOutputs = activityOutputs; OnCreated(); @@ -45,7 +46,7 @@ public Activity(Dictionary> ac /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Option>> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary> activityOutputs = default; + Option>> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); + + return new Activity(activityOutputsParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputs.IsSet) + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 233d362f51ed..1fd3203e3bf6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { Prop1 = prop1; Prop2 = prop2; @@ -47,13 +48,13 @@ public ActivityOutputElementRepresentation(string prop1, Object prop2) /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public Option Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Option Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string prop1 = default; - Object prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -140,13 +141,16 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + Option prop1ParsedValue = new Option(prop1.Value); + Option prop2ParsedValue = new Option(prop2.Value); + + return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); } /// @@ -173,9 +177,11 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); + if (activityOutputElementRepresentation.Prop2.IsSet) + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ed15d711b7a7..155396ce0faf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +41,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -60,49 +61,49 @@ public AdditionalPropertiesClass(Object emptyMap, Dictionary /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Option EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Option>> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Option> MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Option> MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get; set; } + public Option Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -164,14 +165,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object emptyMap = default; - Dictionary> mapOfMapProperty = default; - Dictionary mapProperty = default; - Object mapWithUndeclaredPropertiesAnytype1 = default; - Object mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary mapWithUndeclaredPropertiesString = default; - Object anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -190,35 +191,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -226,28 +227,36 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + Option emptyMapParsedValue = new Option(emptyMap.Value); + Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); + Option> mapPropertyParsedValue = new Option>(mapProperty.Value); + Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); + Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); + Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); + Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); + + return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); } /// @@ -274,22 +283,35 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMap.IsSet) + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapProperty.IsSet) + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapProperty.IsSet) + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1.IsSet) + if (additionalPropertiesClass.Anytype1.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 460543ebf0df..2037c7de4834 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; Color = color; @@ -53,7 +54,7 @@ public Animal(string className, string color = @"red") /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -119,8 +120,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - string color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -138,10 +139,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -149,13 +150,19 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - return new Animal(className, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + string classNameParsedValue = className.Value; + Option colorParsedValue = new Option(color.Value); + + return new Animal(classNameParsedValue, colorParsedValue); } /// @@ -182,8 +189,9 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + writer.WriteString("className", animal.ClassName); + if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a7be95495cc..499ca6fa56a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { Code = code; Message = message; @@ -49,19 +50,19 @@ public ApiResponse(int code, string message, string type) /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public Option Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public Option Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string message = default; - string type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -139,13 +140,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,16 +154,20 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + Option codeParsedValue = new Option(code.Value.Value); + Option messageParsedValue = new Option(message.Value); + Option typeParsedValue = new Option(type.Value); + + return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); } /// @@ -189,9 +194,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); + if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); + if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 31246df0422a..9757102185ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { ColorCode = colorCode; Cultivar = cultivar; @@ -49,19 +50,19 @@ public Apple(string colorCode, string cultivar, string origin) /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public Option ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public Option Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public Option Origin { get; set; } /// /// Gets or Sets additional properties @@ -92,28 +93,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCode.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.Cultivar.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.Origin.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -145,9 +146,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string colorCode = default; - string cultivar = default; - string origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -165,13 +166,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()); break; default: break; @@ -179,16 +180,20 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + Option colorCodeParsedValue = new Option(colorCode.Value); + Option cultivarParsedValue = new Option(cultivar.Value); + Option originParsedValue = new Option(origin.Value); + + return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); } /// @@ -215,9 +220,12 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); + if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); + if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index e0882d925c5d..9470aafaabfc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; Mealy = mealy; @@ -53,7 +54,7 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public Option Mealy { get; set; } /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -121,11 +122,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -133,13 +134,19 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) + if (!cultivar.IsSet) throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + string cultivarParsedValue = cultivar.Value; + Option mealyParsedValue = new Option(mealy.Value.Value); + + return new AppleReq(cultivarParsedValue, mealyParsedValue); } /// @@ -166,8 +173,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + writer.WriteString("cultivar", appleReq.Cultivar); + if (appleReq.Mealy.IsSet) + writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6fc0afdbc300..03aeed86846c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -45,7 +46,7 @@ public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public Option>> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayNumber = default; + Option>> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 0715a3fdf65f..8765bb66ccb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { ArrayNumber = arrayNumber; OnCreated(); @@ -45,7 +46,7 @@ public ArrayOfNumberOnly(List arrayNumber) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public Option> ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayNumber = default; + Option> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); + + return new ArrayOfNumberOnly(arrayNumberParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumber.IsSet) + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 43088ca1d97b..c878e5fbb610 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -49,19 +50,19 @@ public ArrayTest(List> arrayArrayOfInteger, List> /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public Option>> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public Option>> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public Option> ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayOfInteger = default; - List> arrayArrayOfModel = default; - List arrayOfString = default; + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -139,15 +140,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -155,16 +156,20 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); + Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); + Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); + + return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); } /// @@ -191,12 +196,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfInteger.IsSet) + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModel.IsSet) + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfString.IsSet) + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index 75bab7a8d056..04833c9c802b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { LengthCm = lengthCm; OnCreated(); @@ -45,7 +46,7 @@ public Banana(decimal lengthCm) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public Option LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +128,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + Option lengthCmParsedValue = new Option(lengthCm.Value.Value); + + return new Banana(lengthCmParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCm.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCm.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 61e5cf312cca..52e5f2fea76f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; Sweet = sweet; @@ -53,7 +54,7 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public Option Sweet { get; set; } /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -122,11 +123,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -134,13 +135,19 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) + if (!lengthCm.IsSet) throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + decimal lengthCmParsedValue = lengthCm.Value.Value; + Option sweetParsedValue = new Option(sweet.Value.Value); + + return new BananaReq(lengthCmParsedValue, sweetParsedValue); } /// @@ -167,8 +174,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + if (bananaReq.Sweet.IsSet) + writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index c9e4a8bc7120..0dd2d2c9130d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - return new BasquePig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + string classNameParsedValue = className.Value; + + return new BasquePig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index ca7eb413c65b..3452d78a5a89 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -56,37 +57,37 @@ public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public Option ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public Option CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public Option CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public Option SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public Option SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public Option SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -146,12 +147,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string aTTNAME = default; - string capitalCamel = default; - string capitalSnake = default; - string sCAETHFlowPoints = default; - string smallCamel = default; - string smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -169,22 +170,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,25 +193,32 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + Option aTTNAMEParsedValue = new Option(aTTNAME.Value); + Option capitalCamelParsedValue = new Option(capitalCamel.Value); + Option capitalSnakeParsedValue = new Option(capitalSnake.Value); + Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); + Option smallCamelParsedValue = new Option(smallCamel.Value); + Option smallSnakeParsedValue = new Option(smallSnake.Value); + + return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); } /// @@ -237,12 +245,18 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); + if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); + if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); + if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); + if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); + if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 619fc52ce11c..0a668333577c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { Declawed = declawed; OnCreated(); @@ -47,7 +48,7 @@ public Cat(string className, bool declawed, string color = @"red") : base(classN /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public Option Declawed { get; set; } /// /// Returns the string presentation of the object @@ -86,9 +87,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? declawed = default; - string color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -106,14 +107,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -121,16 +122,23 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + string classNameParsedValue = className.Value; + Option declawedParsedValue = new Option(declawed.Value.Value); + Option colorParsedValue = new Option(color.Value); + + return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); } /// @@ -157,9 +165,11 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + writer.WriteString("className", cat.ClassName); + if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); + if (cat.Color.IsSet) + writer.WriteString("color", cat.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 6139c3048390..56876bfbe61b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,30 +32,30 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + Id = id; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } - /// /// Gets or Sets Name /// [JsonPropertyName("name")] public string Name { get; set; } + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets additional properties /// @@ -69,8 +70,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -109,8 +110,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -127,12 +128,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +141,19 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - return new Category(id.Value, name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + string nameParsedValue = name.Value; + Option idParsedValue = new Option(id.Value.Value); + + return new Category(nameParsedValue, idParsedValue); } /// @@ -173,8 +180,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + writer.WriteString("name", category.Name); + if (category.Id.IsSet) + writer.WriteNumber("id", category.Id.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 367e08ca3d32..5dd0845c9926 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { Name = name; PetType = petType; @@ -99,13 +100,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new Option PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Returns the string presentation of the object @@ -145,8 +146,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -164,13 +165,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -178,13 +178,16 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + Option nameParsedValue = new Option(name.Value); + Option petTypeParsedValue = new Option(petType.Value.Value); + + return new ChildCat(nameParsedValue, petTypeParsedValue); } /// @@ -211,9 +214,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); - - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index d1c65d368199..cd5f53658194 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { VarClass = varClass; OnCreated(); @@ -45,7 +46,7 @@ public ClassModel(string varClass) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + Option varClassParsedValue = new Option(varClass.Value); + + return new ClassModel(varClassParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClass.IsSet) + writer.WriteString("_class", classModel.VarClass.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 79579247f7e9..7df2ae2c6ba2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 84439210bcfc..49531e58d0a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - return new DanishPig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + string classNameParsedValue = className.Value; + + return new DanishPig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 4420630af349..8f25aa4445dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -46,7 +47,7 @@ public DateOnlyClass(DateTime dateOnlyProperty) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public Option DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -106,7 +107,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -125,7 +126,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -133,10 +134,12 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); + + return new DateOnlyClass(dateOnlyPropertyParsedValue); } /// @@ -163,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyProperty.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 16e3dfe57faa..bddc970c9c6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { Name = name; OnCreated(); @@ -45,7 +46,7 @@ public DeprecatedObject(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + Option nameParsedValue = new Option(name.Value); + + return new DeprecatedObject(nameParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.Name.IsSet) + writer.WriteString("name", deprecatedObject.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index 810934b95efe..e83852200af0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,11 +32,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { Breed = breed; OnCreated(); @@ -47,7 +48,7 @@ public Dog(string breed, string className, string color = @"red") : base(classNa /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public Option Breed { get; set; } /// /// Returns the string presentation of the object @@ -86,9 +87,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string breed = default; - string className = default; - string color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -105,14 +106,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -120,16 +121,23 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + string classNameParsedValue = className.Value; + Option breedParsedValue = new Option(breed.Value); + Option colorParsedValue = new Option(color.Value); - return new Dog(breed, className, color); + return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); } /// @@ -156,9 +164,11 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + writer.WriteString("className", dog.ClassName); + if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); + if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index 68f7676ff91f..1cf583313f64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -51,25 +52,25 @@ public Drawing(Shape mainShape, List shapes, NullableShape nullableShape /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Option MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public Option> Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get; set; } + public Option NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get; set; } + public Option ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -138,10 +139,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape mainShape = default; - List shapes = default; - NullableShape nullableShape = default; - ShapeOrNull shapeOrNull = default; + Option mainShape = default; + Option> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -160,19 +161,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -180,13 +181,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + Option mainShapeParsedValue = new Option(mainShape.Value); + Option> shapesParsedValue = new Option>(shapes.Value); + + return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); } /// @@ -213,14 +217,28 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShape.IsSet) + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.Shapes.IsSet) + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShape.IsSet) + if (drawing.NullableShape.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNull.IsSet) + if (drawing.ShapeOrNull.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 37e06cb37e3c..5864cc36dda8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -179,13 +180,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public Option JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public Option> ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -241,8 +242,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -261,13 +262,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -275,13 +275,16 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); + Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + + return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); } /// @@ -308,10 +311,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnum.IsSet) + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs index 94c2361c8810..b1aff0adf0d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 1d1ed947dc47..57bebee610a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,23 +32,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { + EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; - EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -57,6 +58,162 @@ public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// @@ -120,7 +277,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public Option EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -185,7 +342,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public Option EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -257,7 +414,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public Option EnumNumber { get; set; } /// /// Defines EnumString @@ -413,187 +570,31 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } - - /// - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + public Option EnumString { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + public Option OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + public Option OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + public Option OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public Option OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -609,11 +610,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -656,15 +657,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -681,53 +682,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -735,31 +730,43 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; + Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); + Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); + Option enumNumberParsedValue = new Option(enumNumber.Value.Value); + Option enumStringParsedValue = new Option(enumString.Value.Value); + Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); + Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); + Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); + + return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); } /// @@ -786,44 +793,47 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); + if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); + if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else - writer.WriteNull("outerEnumDefaultValue"); - - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + writer.WriteNull("enum_string"); - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); - else + if (enumTest.OuterEnumDefaultValue.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumInteger.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValue.IsSet) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnum.IsSet) + if (enumTest.OuterEnum.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 626748ff2097..88e6c4f094b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index 905e5452f7c0..2b2bfc46e5dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { SourceURI = sourceURI; OnCreated(); @@ -46,7 +47,7 @@ public File(string sourceURI) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public Option SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +102,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()); break; default: break; @@ -127,10 +128,12 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + Option sourceURIParsedValue = new Option(sourceURI.Value); + + return new File(sourceURIParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURI.IsSet) + writer.WriteString("sourceURI", file.SourceURI.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 722ba3b949f0..e4c63fb2cbc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option> files = default) { File = file; Files = files; @@ -47,13 +48,13 @@ public FileSchemaTestClass(File file, List files) /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public Option File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public Option> Files { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File file = default; - List files = default; + Option file = default; + Option> files = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -141,13 +142,16 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + Option fileParsedValue = new Option(file.Value); + Option> filesParsedValue = new Option>(files.Value); + + return new FileSchemaTestClass(fileParsedValue, filesParsedValue); } /// @@ -174,10 +178,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.File.IsSet) + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.Files.IsSet) + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index 9cfe3b508fe8..318b62f5da62 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { Bar = bar; OnCreated(); @@ -45,7 +46,7 @@ public Foo(string bar = @"bar") /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public Option Bar { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + Option barParsedValue = new Option(bar.Value); + + return new Foo(barParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.Bar.IsSet) + writer.WriteString("bar", foo.Bar.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c8291e8eae5b..e2e0d7cd52d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { VarString = varString; OnCreated(); @@ -45,7 +46,7 @@ public FooGetDefaultResponse(Foo varString) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + Option varStringParsedValue = new Option(varString.Value); + + return new FooGetDefaultResponse(varStringParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarString.IsSet) + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 30a9b189932a..f0626b6495e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,9 +32,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -41,8 +44,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -51,11 +52,13 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; + Number = number; + Password = password; + Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -63,8 +66,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi Int32 = int32; Int64 = int64; Integer = integer; - Number = number; - Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -77,12 +78,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// @@ -96,106 +91,112 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi [JsonPropertyName("date")] public DateTime Date { get; set; } + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public Option Binary { get; set; } + /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public Option VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public Option VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public Option VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public Option Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public Option Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int Integer { get; set; } - - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } + public Option Integer { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public Option PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public Option PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public Option PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public Option UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public Option UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -211,9 +212,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -221,8 +224,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -242,122 +243,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32.IsSet && this.Int32.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32.IsSet && this.Int32.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.Integer.IsSet && this.Integer.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.Integer.IsSet && this.Integer.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslash.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigits.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiter.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarString.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -398,25 +399,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream binary = default; - byte[] varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string password = default; - string patternWithBackslash = default; - string patternWithDigits = default; - string patternWithDigitsAndDelimiter = default; - string varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -433,76 +434,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -510,64 +511,96 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - - if (varByte == null) + if (!varByte.IsSet) throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (date == null) + if (!date.IsSet) throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + byte[] varByteParsedValue = varByte.Value; + DateTime dateParsedValue = date.Value.Value; + decimal numberParsedValue = number.Value.Value; + string passwordParsedValue = password.Value; + Option binaryParsedValue = new Option(binary.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option varDecimalParsedValue = new Option(varDecimal.Value.Value); + Option varDoubleParsedValue = new Option(varDouble.Value.Value); + Option varFloatParsedValue = new Option(varFloat.Value.Value); + Option int32ParsedValue = new Option(int32.Value.Value); + Option int64ParsedValue = new Option(int64.Value.Value); + Option integerParsedValue = new Option(integer.Value.Value); + Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); + Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); + Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); + Option varStringParsedValue = new Option(varString.Value); + Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); + Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); } /// @@ -594,28 +627,43 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + if (formatTest.Binary.IsSet) + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); + if (formatTest.VarDecimal.IsSet) + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); + if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); + if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); + if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); + if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); + if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); + if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); + if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); + if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); + if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); + if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); + if (formatTest.Uuid.IsSet) + writer.WriteString("uuid", formatTest.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index 2e05ffb958a4..b50b03bfbf2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; Color = color; @@ -45,7 +46,7 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; Color = color; @@ -68,7 +69,7 @@ public Fruit(Banana banana, string color) /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -116,7 +117,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -156,7 +157,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -164,14 +165,16 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option colorParsedValue = new Option(color.Value); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, colorParsedValue); if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, colorParsedValue); throw new JsonException(); } @@ -200,7 +203,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs index aa26d3600c05..75652a1b436e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index 3c2d1ecefc94..ac335a65c61b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple apple, Banana banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { Apple = apple; Banana = banana; @@ -47,18 +48,18 @@ public GmFruit(Apple apple, Banana banana, string color) /// /// Gets or Sets Apple /// - public Apple Apple { get; set; } + public Option Apple { get; set; } /// /// Gets or Sets Banana /// - public Banana Banana { get; set; } + public Option Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -106,7 +107,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -146,7 +147,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,10 +155,15 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option colorParsedValue = new Option(color.Value); + + Option appleParsedValue = new Option(apple); + Option bananaParsedValue = new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); } /// @@ -171,16 +177,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -196,7 +202,8 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.Color.IsSet) + writer.WriteString("color", gmFruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7ae4662ed8d4..df79594c7836 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,7 +111,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -128,7 +129,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -136,10 +137,15 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - return new GrandparentAnimal(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + string petTypeParsedValue = petType.Value; + + return new GrandparentAnimal(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 31360d73f754..05d6dc00c0b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { Bar = bar; Foo = foo; @@ -47,13 +48,13 @@ internal HasOnlyReadOnly(string bar, string foo) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public Option Foo { get; } /// /// Gets or Sets additional properties @@ -146,8 +147,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -165,10 +166,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()); break; default: break; @@ -176,13 +177,16 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + Option barParsedValue = new Option(bar.Value); + Option fooParsedValue = new Option(foo.Value); + + return new HasOnlyReadOnly(barParsedValue, fooParsedValue); } /// @@ -209,8 +213,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); + if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 8355d97fa097..82ddf5d26c2a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -45,7 +46,7 @@ public HealthCheckResult(string nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get; set; } + public Option NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,7 +154,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessage.IsSet) + if (healthCheckResult.NullableMessage.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 0355613042f2..bfb2e51e08d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,8 +103,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -121,10 +122,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -132,13 +133,22 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -165,8 +175,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index 42b0c9cb2cf1..cf07e34fb205 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { Var123List = var123List; OnCreated(); @@ -45,7 +46,7 @@ public List(string var123List) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public Option Var123List { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + Option var123ListParsedValue = new Option(var123List.Value); + + return new List(var123ListParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123List.IsSet) + writer.WriteString("123-list", list.Var123List.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0ad8832af885..41d23030588a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -47,13 +48,13 @@ public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public Option EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public Option UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string escapedLiteralString = default; - string unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,16 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); + Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); + + return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); } /// @@ -172,8 +176,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); + if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 92011ad0e1d9..6d861cf51efc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -150,7 +151,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; Pig pig = null; Whale whale = null; @@ -207,7 +208,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,22 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + string classNameParsedValue = className.Value; + if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, classNameParsedValue); if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, classNameParsedValue); if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index c99356fbf3a8..c6fdd5671ee6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { DirectMap = directMap; IndirectMap = indirectMap; @@ -117,25 +118,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Option> DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Option> IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Option>> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Option> MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -193,10 +194,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary directMap = default; - Dictionary indirectMap = default; - Dictionary> mapMapOfString = default; - Dictionary mapOfEnumString = default; + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -215,19 +216,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -235,19 +236,24 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + Option> directMapParsedValue = new Option>(directMap.Value); + Option> indirectMapParsedValue = new Option>(indirectMap.Value); + Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); + Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + + return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); } /// @@ -274,14 +280,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMap.IsSet) + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMap.IsSet) + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfString.IsSet) + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumString.IsSet) + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 0ed70f02c2db..bd0f20d5fc16 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { DateTime = dateTime; Map = map; @@ -51,25 +52,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Option> Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Option UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +104,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -138,10 +139,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -160,19 +161,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -180,19 +181,24 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option> mapParsedValue = new Option>(map.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); + Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); } /// @@ -219,11 +225,15 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); + if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 7969b9ae04ed..8c3506247137 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { VarClass = varClass; Name = name; @@ -47,13 +48,13 @@ public Model200Response(string varClass, int name) /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -140,13 +141,16 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + Option varClassParsedValue = new Option(varClass.Value); + Option nameParsedValue = new Option(name.Value.Value); + + return new Model200Response(varClassParsedValue, nameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); + if (model200Response.Name.IsSet) + writer.WriteNumber("name", model200Response.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index 810a6a01b8e9..352915a9b5ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { VarClient = varClient; OnCreated(); @@ -45,7 +46,7 @@ public ModelClient(string varClient) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public Option VarClient { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + Option varClientParsedValue = new Option(varClient.Value); + + return new ModelClient(varClientParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClient.IsSet) + writer.WriteString("client", modelClient.VarClient.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index edcb6b3403c7..25e952643413 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; Property = property; @@ -57,19 +58,19 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public Option Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public Option SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public Option Var123Number { get; } /// /// Gets or Sets additional properties @@ -164,10 +165,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -186,18 +187,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -205,19 +206,27 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) + if (!varName.IsSet) throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + if (var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + int varNameParsedValue = varName.Value.Value; + Option propertyParsedValue = new Option(property.Value); + Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); + Option var123NumberParsedValue = new Option(var123Number.Value.Value); + + return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); } /// @@ -244,10 +253,13 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + writer.WriteNumber("name", name.VarName); + if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); + if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); + if (name.Var123Number.IsSet) + writer.WriteNumber("123Number", name.Var123Number.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 83ab7f40b1e8..566cd90fa667 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -141,13 +142,22 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) + if (!aObjVariableobject.IsSet) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (pkiNotificationtestID == null) + if (!pkiNotificationtestID.IsSet) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + List> aObjVariableobjectParsedValue = aObjVariableobject.Value; + int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 5d9de18c4a36..82dd5aa886b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,7 +45,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -67,73 +68,73 @@ public NullableClass(List arrayItemsNullable, Dictionary /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public Option> ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Option> ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get; set; } + public Option> ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get; set; } + public Option> ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public Option BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public Option DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public Option DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public Option IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public Option NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get; set; } + public Option> ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get; set; } + public Option> ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get; set; } + public Option StringProp { get; set; } /// /// Gets or Sets additional properties @@ -220,18 +221,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayItemsNullable = default; - Dictionary objectItemsNullable = default; - List arrayAndItemsNullableProp = default; - List arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary objectAndItemsNullableProp = default; - Dictionary objectNullableProp = default; - string stringProp = default; + Option> arrayItemsNullable = default; + Option> objectItemsNullable = default; + Option> arrayAndItemsNullableProp = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -250,50 +251,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -301,13 +302,16 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); + Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); + + return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -334,45 +338,74 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullable.IsSet) + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullable.IsSet) + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullableProp.IsSet) + if (nullableClass.ArrayAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullableProp.IsSet) + if (nullableClass.ArrayNullableProp.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); + if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); + if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); + if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.ObjectAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullableProp.IsSet) + if (nullableClass.ObjectNullableProp.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 684109acd50f..6630472d83cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { Uuid = uuid; OnCreated(); @@ -46,7 +47,7 @@ public NullableGuidClass(Guid? uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +102,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -155,11 +156,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.Uuid.IsSet) + if (nullableGuidClass.Uuid.Value != null) + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index a44c950b81bb..67194a079381 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 3f3cbf4c5059..c54ed6a54175 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { JustNumber = justNumber; OnCreated(); @@ -45,7 +46,7 @@ public NumberOnly(decimal justNumber) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public Option JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +128,12 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + Option justNumberParsedValue = new Option(justNumber.Value.Value); + + return new NumberOnly(justNumberParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumber.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 57a1614f29f4..fb0980df5aa3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -52,27 +53,27 @@ public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecated /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public Option> Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public Option DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -130,10 +131,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List bars = default; - DeprecatedObject deprecatedRef = default; - decimal? id = default; - string uuid = default; + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -152,18 +153,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()); break; default: break; @@ -171,19 +172,24 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + Option> barsParsedValue = new Option>(bars.Value); + Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); + Option idParsedValue = new Option(id.Value.Value); + Option uuidParsedValue = new Option(uuid.Value); + + return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); } /// @@ -210,12 +216,16 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.Bars.IsSet) + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRef.IsSet) + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); + if (objectWithDeprecatedFields.Uuid.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs index 91dd67631614..660604e3ef17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index 13afecfac3f6..47d090894c79 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { Id = id; PetId = petId; @@ -137,38 +138,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public Option PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public Option Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public Option ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public Option Complete { get; set; } /// /// Gets or Sets additional properties @@ -233,12 +234,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -257,29 +258,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -287,25 +287,32 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + Option idParsedValue = new Option(id.Value.Value); + Option petIdParsedValue = new Option(petId.Value.Value); + Option quantityParsedValue = new Option(quantity.Value.Value); + Option shipDateParsedValue = new Option(shipDate.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option completeParsedValue = new Option(complete.Value.Value); + + return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); } /// @@ -332,18 +339,22 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); - - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); + if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); + if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); + if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); + var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.Complete.IsSet) + writer.WriteBoolean("complete", order.Complete.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index c37883db124b..6c3f344b967d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -49,19 +50,19 @@ public OuterComposite(bool myBoolean, decimal myNumber, string myString) /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public Option MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public Option MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public Option MyString { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -139,14 +140,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,16 +155,20 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + Option myBooleanParsedValue = new Option(myBoolean.Value.Value); + Option myNumberParsedValue = new Option(myNumber.Value.Value); + Option myStringParsedValue = new Option(myString.Value); + + return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); } /// @@ -190,9 +195,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); + if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); + if (outerComposite.MyString.IsSet) + writer.WriteString("my_string", outerComposite.MyString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs index a4ec335bb386..47bb6793c6ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7c67db5ddca3..136fb4c54c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 84ea65297ab0..2ed4f18a657e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 983d194a1998..c6a470cc64d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 51d8bee407e0..a2e789f2edef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index eb0129c6ce0f..52a9b17f7c39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -76,7 +77,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -94,7 +95,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -102,10 +103,15 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - return new ParentPet(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + string petTypeParsedValue = petType.Value; + + return new ParentPet(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index aa380014a324..0dcd9935f9ca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,19 +32,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; + Category = category; + Id = id; Status = status; Tags = tags; OnCreated(); @@ -137,19 +138,7 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } - - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Category Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } + public Option Status { get; set; } /// /// Gets or Sets Name @@ -164,11 +153,23 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Option Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public Option> Tags { get; set; } /// /// Gets or Sets additional properties @@ -184,10 +185,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -228,12 +229,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category category = default; - long? id = default; - string name = default; - List photoUrls = default; - Pet.StatusEnum? status = default; - List tags = default; + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; while (utf8JsonReader.Read()) { @@ -250,30 +251,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -281,25 +281,38 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (photoUrls == null) + if (!photoUrls.IsSet) throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + if (category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + string nameParsedValue = name.Value; + List photoUrlsParsedValue = photoUrls.Value; + Option categoryParsedValue = new Option(category.Value); + Option idParsedValue = new Option(id.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option> tagsParsedValue = new Option>(tags.Value); + + return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); } /// @@ -326,21 +339,23 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.Category.IsSet) + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.Tags.IsSet) + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index 8185d643e794..fcc56f4a1389 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -184,7 +185,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + string classNameParsedValue = className.Value; + if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, classNameParsedValue); if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 3a89a8716e07..2c2227a22512 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 65f7b8b4536f..ae4d33e381d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -184,7 +185,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index c329eed3266b..664d4eb101fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + + return new QuadrilateralInterface(quadrilateralTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 2c8b4fff43d6..299bcb68898d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { Bar = bar; Baz = baz; @@ -47,13 +48,13 @@ public ReadOnlyFirst(string bar, string baz) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public Option Baz { get; set; } /// /// Gets or Sets additional properties @@ -145,8 +146,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -164,10 +165,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()); break; default: break; @@ -175,13 +176,16 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + Option barParsedValue = new Option(bar.Value); + Option bazParsedValue = new Option(baz.Value); + + return new ReadOnlyFirst(barParsedValue, bazParsedValue); } /// @@ -208,8 +212,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); + if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..4895eff3b068 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2221 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDateProp = notRequiredNullableDateProp; + NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumString = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringProp = notrequiredNullableStringProp; + NotrequiredNullableUuid = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public Option NotrequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public Option NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public Option NotrequiredNullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public Option NotrequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public Option NotrequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public Option NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public Option NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public Option> NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public Option NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public Option NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public Option NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Option NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public Option NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public Option NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public Option> NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public Option NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public Option NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public Option NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Option NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + + if (requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; + List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; + bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; + DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; + RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; + OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; + string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; + Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; + int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; + Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); + Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); + Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); + Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); + Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); + Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); + Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); + Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); + Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); + Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); + Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); + List requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; + bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; + DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; + DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; + RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; + RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; + RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; + int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; + OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; + string requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; + Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; + + return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); + if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); + if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); + if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); + if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); + if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNullableArrayOfString.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); + if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index 86e7223ee957..261fdb8d1758 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { VarReturn = varReturn; OnCreated(); @@ -45,7 +46,7 @@ public Return(int varReturn) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public Option VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -127,10 +128,12 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + Option varReturnParsedValue = new Option(varReturn.Value.Value); + + return new Return(varReturnParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturn.IsSet) + writer.WriteNumber("return", varReturn.VarReturn.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 86effcebe7ae..3ed7cc9a1f4d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { Role = role; RoleUuid = roleUuid; @@ -47,13 +48,13 @@ public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public Option Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Option RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -141,13 +142,16 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + Option roleParsedValue = new Option(role.Value); + Option roleUuidParsedValue = new Option(roleUuid.Value.Value); + + return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); } /// @@ -174,9 +178,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.Role.IsSet) + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuid.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index c7002b77b2e1..dea47cec965a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { Name = name; OnCreated(); @@ -45,7 +46,7 @@ public RolesReportsHashRole(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + Option nameParsedValue = new Option(name.Value); + + return new RolesReportsHashRole(nameParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.Name.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 4151ead57dfb..28832300fbb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index dae0ef02f966..93c0bfceac47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index de32fa535aec..8268d60aca90 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - return new ShapeInterface(shapeType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + string shapeTypeParsedValue = shapeType.Value; + + return new ShapeInterface(shapeTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 955461e12024..42c7f891e754 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 7f0b8a306f80..dc0e716e4104 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 8328ad3ee121..60097640238f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -47,13 +48,13 @@ public SpecialModelName(string varSpecialModelName, long specialPropertyName) /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public Option VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public Option SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +141,16 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); + Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); + + return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); + if (specialModelName.SpecialPropertyName.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index 6524d75edcf5..47a114ecc78f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { Id = id; Name = name; @@ -47,13 +48,13 @@ public Tag(long id, string name) /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -129,10 +130,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -140,13 +141,16 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + Option idParsedValue = new Option(id.Value.Value); + Option nameParsedValue = new Option(name.Value); + + return new Tag(idParsedValue, nameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); + if (tag.Name.IsSet) + writer.WriteString("name", tag.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b2e110e79f67..8db7c285f6b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { Value = value; OnCreated(); @@ -45,7 +46,7 @@ public TestCollectionEndingWithWordList(string value) /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public Option Value { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + Option valueParsedValue = new Option(value.Value); + + return new TestCollectionEndingWithWordList(valueParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.Value.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 8753edfd9f35..6ea936534a86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -45,7 +46,7 @@ public TestCollectionEndingWithWordListObject(List [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public Option> TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List testCollectionEndingWithWordList = default; + Option> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 139e92b4c6a8..4894c12d6f39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { SomeProperty = someProperty; OnCreated(); @@ -45,7 +46,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public Option SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -111,7 +112,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +130,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()); break; default: break; @@ -137,10 +138,12 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + Option somePropertyParsedValue = new Option(someProperty.Value); + + return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); } /// @@ -167,7 +170,8 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index 814316961f91..d48412119583 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -150,7 +151,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -207,7 +208,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,22 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + string triangleTypeParsedValue = triangleType.Value; + if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleTypeParsedValue); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleTypeParsedValue); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 6bd1e4303a70..d0552a4dfeaf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - return new TriangleInterface(triangleType); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + string triangleTypeParsedValue = triangleType.Value; + + return new TriangleInterface(triangleTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index ea527b94ec08..9c0be73daa82 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,7 +45,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -67,78 +68,78 @@ public User(string email, string firstName, long id, string lastName, Object obj /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public Option Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public Option FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public Option LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Option ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public Option Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public Option Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public Option UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public Option Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get; set; } + public Option AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get; set; } + public Option AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get; set; } + public Option ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -204,18 +205,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string email = default; - string firstName = default; - long? id = default; - string lastName = default; - Object objectWithNoDeclaredProps = default; - string password = default; - string phone = default; - int? userStatus = default; - string username = default; - Object anyTypeProp = default; - Object anyTypePropNullable = default; - Object objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -233,46 +234,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -280,34 +281,44 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + Option emailParsedValue = new Option(email.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option idParsedValue = new Option(id.Value.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); + Option passwordParsedValue = new Option(password.Value); + Option phoneParsedValue = new Option(phone.Value); + Option userStatusParsedValue = new Option(userStatus.Value.Value); + Option usernameParsedValue = new Option(username.Value); + + return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -334,22 +345,49 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); + if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); + if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); + if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); + if (user.ObjectWithNoDeclaredProps.IsSet) + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); + if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); + if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); + if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); + if (user.AnyTypeProp.IsSet) + if (user.AnyTypeProp.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullable.IsSet) + if (user.AnyTypePropNullable.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullable.IsSet) + if (user.ObjectWithNoDeclaredPropsNullable.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index e633a5c92cf5..67710b37d78a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; HasBaleen = hasBaleen; @@ -55,13 +56,13 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public Option HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public Option HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -138,15 +139,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -154,16 +155,23 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + if (hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + string classNameParsedValue = className.Value; + Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); + Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); + + return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); } /// @@ -190,9 +198,11 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + writer.WriteString("className", whale.ClassName); + if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); + if (whale.HasTeeth.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 503c47228cdf..03c924490df9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; Type = type; @@ -127,7 +128,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets ClassName @@ -200,8 +201,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -219,13 +220,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -233,13 +233,19 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + string classNameParsedValue = className.Value; + Option typeParsedValue = new Option(type.Value.Value); + + return new Zebra(classNameParsedValue, typeParsedValue); } /// @@ -266,9 +272,8 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); - - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + writer.WriteString("className", zebra.ClassName); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 20e184f02b2b..34a044fb8b13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index c590ea6644ba..042dcb1ca2ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -111,7 +112,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public Option ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -166,7 +167,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -185,9 +186,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -195,10 +195,12 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + + return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); } /// @@ -225,8 +227,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs index 663aecff33e7..17ce2890bdc5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index 93bfff98acc2..ba5f482115ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Adult : Person, IValidatableObject /// lastName /// type [JsonConstructor] - public Adult(List children, string firstName, string lastName, string type) : base(firstName, lastName, type) + public Adult(Option> children = default, Option firstName = default, Option lastName = default, Option type = default) : base(firstName, lastName, type) { Children = children; OnCreated(); @@ -50,7 +51,7 @@ public Adult(List children, string firstName, string lastName, string typ /// Gets or Sets Children /// [JsonPropertyName("children")] - public List Children { get; set; } + public Option> Children { get; set; } /// /// Returns the string presentation of the object @@ -89,10 +90,10 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? children = default; - string? firstName = default; - string? lastName = default; - string? type = default; + Option?> children = default; + Option firstName = default; + Option lastName = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -111,16 +112,16 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "children": if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,19 +129,24 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (children == null) - throw new ArgumentNullException(nameof(children), "Property is required for class Adult."); + if (children.Value == null) + throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Adult."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Adult."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Adult."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Adult."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult."); - return new Adult(children, firstName, lastName, type); + Option> childrenParsedValue = new Option>(children.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option typeParsedValue = new Option(type.Value); + + return new Adult(childrenParsedValue, firstNameParsedValue, lastNameParsedValue, typeParsedValue); } /// @@ -167,11 +173,15 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("children"); - JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); - writer.WriteString("firstName", adult.FirstName); - writer.WriteString("lastName", adult.LastName); - writer.WriteString("$_type", adult.Type); + if (adult.Children.IsSet) + writer.WritePropertyName("children"); + JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + if (adult.FirstName.IsSet) + writer.WriteString("firstName", adult.FirstName.Value); + if (adult.LastName.IsSet) + writer.WriteString("lastName", adult.LastName.Value); + if (adult.Type.IsSet) + writer.WriteString("$_type", adult.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index 0814fec25b7a..c27a2df57c1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +40,7 @@ public partial class Child : Person, IValidatableObject /// type /// boosterSeat [JsonConstructor] - public Child(int age, string firstName, string lastName, string type, bool boosterSeat) : base(firstName, lastName, type) + public Child(Option age = default, Option firstName = default, Option lastName = default, Option type = default, Option boosterSeat = default) : base(firstName, lastName, type) { Age = age; BoosterSeat = boosterSeat; @@ -52,13 +53,13 @@ public Child(int age, string firstName, string lastName, string type, bool boost /// Gets or Sets Age /// [JsonPropertyName("age")] - public int Age { get; set; } + public Option Age { get; set; } /// /// Gets or Sets BoosterSeat /// [JsonPropertyName("boosterSeat")] - public bool BoosterSeat { get; set; } + public Option BoosterSeat { get; set; } /// /// Returns the string presentation of the object @@ -98,11 +99,11 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? age = default; - string? firstName = default; - string? lastName = default; - string? type = default; - bool? boosterSeat = default; + Option age = default; + Option firstName = default; + Option lastName = default; + Option type = default; + Option boosterSeat = default; while (utf8JsonReader.Read()) { @@ -121,20 +122,20 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "age": if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = utf8JsonReader.GetInt32(); + age = new Option(utf8JsonReader.GetInt32()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; case "boosterSeat": if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = utf8JsonReader.GetBoolean(); + boosterSeat = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -142,22 +143,28 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (age == null) - throw new ArgumentNullException(nameof(age), "Property is required for class Child."); + if (age.Value == null) + throw new ArgumentNullException(nameof(age), "Property is not nullable for class Child."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Child."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Child."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Child."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Child."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Child."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Child."); - if (boosterSeat == null) - throw new ArgumentNullException(nameof(boosterSeat), "Property is required for class Child."); + if (boosterSeat.Value == null) + throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child."); - return new Child(age.Value, firstName, lastName, type, boosterSeat.Value); + Option ageParsedValue = new Option(age.Value.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option typeParsedValue = new Option(type.Value); + Option boosterSeatParsedValue = new Option(boosterSeat.Value.Value); + + return new Child(ageParsedValue, firstNameParsedValue, lastNameParsedValue, typeParsedValue, boosterSeatParsedValue); } /// @@ -184,11 +191,16 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("age", child.Age); - writer.WriteString("firstName", child.FirstName); - writer.WriteString("lastName", child.LastName); - writer.WriteString("$_type", child.Type); - writer.WriteBoolean("boosterSeat", child.BoosterSeat); + if (child.Age.IsSet) + writer.WriteNumber("age", child.Age.Value); + if (child.FirstName.IsSet) + writer.WriteString("firstName", child.FirstName.Value); + if (child.LastName.IsSet) + writer.WriteString("lastName", child.LastName.Value); + if (child.Type.IsSet) + writer.WriteString("$_type", child.Type.Value); + if (child.BoosterSeat.IsSet) + writer.WriteBoolean("boosterSeat", child.BoosterSeat.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index 150e974367e1..dc35b07c4568 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +38,7 @@ public partial class Person : IValidatableObject /// lastName /// type [JsonConstructor] - public Person(string firstName, string lastName, string type) + public Person(Option firstName = default, Option lastName = default, Option type = default) { FirstName = firstName; LastName = lastName; @@ -51,19 +52,19 @@ public Person(string firstName, string lastName, string type) /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public Option FirstName { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public Option LastName { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("$_type")] - public string Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets additional properties @@ -130,9 +131,9 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? firstName = default; - string? lastName = default; - string? type = default; + Option firstName = default; + Option lastName = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -150,13 +151,13 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -164,16 +165,20 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Person."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Person."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Person."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Person."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Person."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person."); - return new Person(firstName, lastName, type); + Option firstNameParsedValue = new Option(firstName.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option typeParsedValue = new Option(type.Value); + + return new Person(firstNameParsedValue, lastNameParsedValue, typeParsedValue); } /// @@ -200,9 +205,12 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("firstName", person.FirstName); - writer.WriteString("lastName", person.LastName); - writer.WriteString("$_type", person.Type); + if (person.FirstName.IsSet) + writer.WriteString("firstName", person.FirstName.Value); + if (person.LastName.IsSet) + writer.WriteString("lastName", person.LastName.Value); + if (person.Type.IsSet) + writer.WriteString("$_type", person.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs index 3c370b043a54..42ecb4255353 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index 376581340835..4113fc73e30e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(string kind) + public Apple(Option kind = default) { Kind = kind; OnCreated(); @@ -47,7 +48,7 @@ public Apple(string kind) /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string Kind { get; set; } + public Option Kind { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? kind = default; + Option kind = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = utf8JsonReader.GetString(); + kind = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,12 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind == null) - throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); + if (kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); + Option kindParsedValue = new Option(kind.Value); + + return new Apple(kindParsedValue); } /// @@ -158,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("kind", apple.Kind); + if (apple.Kind.IsSet) + writer.WriteString("kind", apple.Kind.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs index 003d499475e9..8ad280cacb4c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(decimal count) + public Banana(Option count = default) { Count = count; OnCreated(); @@ -47,7 +48,7 @@ public Banana(decimal count) /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal Count { get; set; } + public Option Count { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? count = default; + Option count = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = utf8JsonReader.GetDecimal(); + count = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +130,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count == null) - throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); + if (count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count.Value); + Option countParsedValue = new Option(count.Value.Value); + + return new Banana(countParsedValue); } /// @@ -159,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("count", banana.Count); + if (banana.Count.IsSet) + writer.WriteNumber("count", banana.Count.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index 7cd885961b7b..d6075748f0f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple? apple, Banana? banana, string color) + public Fruit(Option apple, Option banana, Option color = default) { Apple = apple; Banana = banana; @@ -49,18 +50,18 @@ public Fruit(Apple? apple, Banana? banana, string color) /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Option Apple { get; set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Option Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -115,7 +116,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -155,7 +156,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -163,10 +164,15 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - return new Fruit(apple, banana, color); + Option colorParsedValue = new Option(color.Value); + + Option appleParsedValue = new Option(apple); + Option bananaParsedValue = new Option(banana); + + return new Fruit(appleParsedValue, bananaParsedValue, colorParsedValue); } /// @@ -180,16 +186,16 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt { writer.WriteStartObject(); - if (fruit.Apple != null) + if (fruit.Apple.IsSet && fruit.Apple.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, fruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Apple.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, fruit.Apple.Value, jsonSerializerOptions); } - if (fruit.Banana != null) + if (fruit.Banana.IsSet && fruit.Banana.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, fruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Banana.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, fruit.Banana.Value, jsonSerializerOptions); } WriteProperties(ref writer, fruit, jsonSerializerOptions); @@ -205,7 +211,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs index 3c370b043a54..42ecb4255353 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index 376581340835..4113fc73e30e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(string kind) + public Apple(Option kind = default) { Kind = kind; OnCreated(); @@ -47,7 +48,7 @@ public Apple(string kind) /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string Kind { get; set; } + public Option Kind { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? kind = default; + Option kind = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = utf8JsonReader.GetString(); + kind = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,12 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind == null) - throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); + if (kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); + Option kindParsedValue = new Option(kind.Value); + + return new Apple(kindParsedValue); } /// @@ -158,7 +161,8 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("kind", apple.Kind); + if (apple.Kind.IsSet) + writer.WriteString("kind", apple.Kind.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs index 003d499475e9..8ad280cacb4c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(decimal count) + public Banana(Option count = default) { Count = count; OnCreated(); @@ -47,7 +48,7 @@ public Banana(decimal count) /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal Count { get; set; } + public Option Count { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? count = default; + Option count = default; while (utf8JsonReader.Read()) { @@ -121,7 +122,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = utf8JsonReader.GetDecimal(); + count = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +130,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count == null) - throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); + if (count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count.Value); + Option countParsedValue = new Option(count.Value.Value); + + return new Banana(countParsedValue); } /// @@ -159,7 +162,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("count", banana.Count); + if (banana.Count.IsSet) + writer.WriteNumber("count", banana.Count.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index 4310e800fe99..fff91553d610 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; Color = color; @@ -47,7 +48,7 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; Color = color; @@ -70,7 +71,7 @@ public Fruit(Banana banana, string color) /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -125,7 +126,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -165,7 +166,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -173,14 +174,16 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option colorParsedValue = new Option(color.Value); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, colorParsedValue); if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, colorParsedValue); throw new JsonException(); } @@ -209,7 +212,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 6c82be59af88..62a5cdba43b7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,6 +219,16 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } + /// + /// Test TestInlineFreeformAdditionalProperties + /// + [Fact (Skip = "not implemented")] + public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() + { + TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; + await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); + } + /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index 7fe8f333c81a..b78fc06d07c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index e5a97f428662..bfec38903066 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,6 +53,15 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'EnumInteger' /// @@ -89,15 +98,6 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index fbffe502af78..164baa8862be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -53,15 +53,6 @@ public void FormatTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'Binary' - /// - [Fact] - public void BinaryTest() - { - // TODO unit test for the property 'Binary' - } - /// /// Test the property 'VarByte' /// @@ -80,6 +71,33 @@ public void DateTest() // TODO unit test for the property 'Date' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + + /// + /// Test the property 'Binary' + /// + [Fact] + public void BinaryTest() + { + // TODO unit test for the property 'Binary' + } + /// /// Test the property 'DateTime' /// @@ -143,24 +161,6 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } - /// - /// Test the property 'Number' - /// - [Fact] - public void NumberTest() - { - // TODO unit test for the property 'Number' - } - - /// - /// Test the property 'Password' - /// - [Fact] - public void PasswordTest() - { - // TODO unit test for the property 'Password' - } - /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index fff8db45faad..8485d1213ce6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..6e8958b1b749 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index fdb21c230bf9..a30072d27fae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -139,6 +139,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -147,8 +149,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -165,6 +165,30 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 964d9c24a144..903a95cb48ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,6 +114,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs index 70f41078bb68..34653363aacf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,5 +35,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option o) => o.Value; + + /// + /// Implicitly constructs a new Option + /// + /// + public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 42747dee35ea..7cca29511188 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs = default) { ActivityOutputs = activityOutputs; OnCreated(); @@ -45,7 +46,7 @@ public Activity(Dictionary> ac /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Option>> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary> activityOutputs = default; + Option>> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); + + return new Activity(activityOutputsParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputs.IsSet) + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 233d362f51ed..1fd3203e3bf6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { Prop1 = prop1; Prop2 = prop2; @@ -47,13 +48,13 @@ public ActivityOutputElementRepresentation(string prop1, Object prop2) /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public Option Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Option Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string prop1 = default; - Object prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -140,13 +141,16 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + Option prop1ParsedValue = new Option(prop1.Value); + Option prop2ParsedValue = new Option(prop2.Value); + + return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); } /// @@ -173,9 +177,11 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); + if (activityOutputElementRepresentation.Prop2.IsSet) + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ed15d711b7a7..155396ce0faf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +41,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -60,49 +61,49 @@ public AdditionalPropertiesClass(Object emptyMap, Dictionary /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Option EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Option>> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Option> MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Option> MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get; set; } + public Option Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -164,14 +165,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object emptyMap = default; - Dictionary> mapOfMapProperty = default; - Dictionary mapProperty = default; - Object mapWithUndeclaredPropertiesAnytype1 = default; - Object mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary mapWithUndeclaredPropertiesString = default; - Object anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -190,35 +191,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -226,28 +227,36 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + Option emptyMapParsedValue = new Option(emptyMap.Value); + Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); + Option> mapPropertyParsedValue = new Option>(mapProperty.Value); + Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); + Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); + Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); + Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); + + return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); } /// @@ -274,22 +283,35 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMap.IsSet) + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapProperty.IsSet) + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapProperty.IsSet) + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1.IsSet) + if (additionalPropertiesClass.Anytype1.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 460543ebf0df..2037c7de4834 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; Color = color; @@ -53,7 +54,7 @@ public Animal(string className, string color = @"red") /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Gets or Sets additional properties @@ -119,8 +120,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - string color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -138,10 +139,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -149,13 +150,19 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - return new Animal(className, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); + + string classNameParsedValue = className.Value; + Option colorParsedValue = new Option(color.Value); + + return new Animal(classNameParsedValue, colorParsedValue); } /// @@ -182,8 +189,9 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + writer.WriteString("className", animal.ClassName); + if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a7be95495cc..499ca6fa56a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { Code = code; Message = message; @@ -49,19 +50,19 @@ public ApiResponse(int code, string message, string type) /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public Option Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public Option Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public Option Type { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string message = default; - string type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -139,13 +140,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,16 +154,20 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + Option codeParsedValue = new Option(code.Value.Value); + Option messageParsedValue = new Option(message.Value); + Option typeParsedValue = new Option(type.Value); + + return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); } /// @@ -189,9 +194,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); + if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); + if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 31246df0422a..9757102185ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { ColorCode = colorCode; Cultivar = cultivar; @@ -49,19 +50,19 @@ public Apple(string colorCode, string cultivar, string origin) /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public Option ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public Option Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public Option Origin { get; set; } /// /// Gets or Sets additional properties @@ -92,28 +93,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCode.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.Cultivar.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.Origin.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -145,9 +146,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string colorCode = default; - string cultivar = default; - string origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -165,13 +166,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()); break; default: break; @@ -179,16 +180,20 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + Option colorCodeParsedValue = new Option(colorCode.Value); + Option cultivarParsedValue = new Option(cultivar.Value); + Option originParsedValue = new Option(origin.Value); + + return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); } /// @@ -215,9 +220,12 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); + if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); + if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index e0882d925c5d..9470aafaabfc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; Mealy = mealy; @@ -53,7 +54,7 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public Option Mealy { get; set; } /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -121,11 +122,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -133,13 +134,19 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) + if (!cultivar.IsSet) throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + string cultivarParsedValue = cultivar.Value; + Option mealyParsedValue = new Option(mealy.Value.Value); + + return new AppleReq(cultivarParsedValue, mealyParsedValue); } /// @@ -166,8 +173,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + writer.WriteString("cultivar", appleReq.Cultivar); + if (appleReq.Mealy.IsSet) + writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6fc0afdbc300..03aeed86846c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -45,7 +46,7 @@ public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public Option>> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayNumber = default; + Option>> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); + + return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 0715a3fdf65f..8765bb66ccb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { ArrayNumber = arrayNumber; OnCreated(); @@ -45,7 +46,7 @@ public ArrayOfNumberOnly(List arrayNumber) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public Option> ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayNumber = default; + Option> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); + + return new ArrayOfNumberOnly(arrayNumberParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumber.IsSet) + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 43088ca1d97b..c878e5fbb610 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -49,19 +50,19 @@ public ArrayTest(List> arrayArrayOfInteger, List> /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public Option>> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public Option>> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public Option> ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayOfInteger = default; - List> arrayArrayOfModel = default; - List arrayOfString = default; + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -139,15 +140,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -155,16 +156,20 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); + Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); + Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); + + return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); } /// @@ -191,12 +196,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfInteger.IsSet) + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModel.IsSet) + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfString.IsSet) + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs index 75bab7a8d056..04833c9c802b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { LengthCm = lengthCm; OnCreated(); @@ -45,7 +46,7 @@ public Banana(decimal lengthCm) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public Option LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +128,12 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + Option lengthCmParsedValue = new Option(lengthCm.Value.Value); + + return new Banana(lengthCmParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCm.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCm.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index 61e5cf312cca..52e5f2fea76f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; Sweet = sweet; @@ -53,7 +54,7 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public Option Sweet { get; set; } /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -122,11 +123,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -134,13 +135,19 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) + if (!lengthCm.IsSet) throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + decimal lengthCmParsedValue = lengthCm.Value.Value; + Option sweetParsedValue = new Option(sweet.Value.Value); + + return new BananaReq(lengthCmParsedValue, sweetParsedValue); } /// @@ -167,8 +174,9 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + if (bananaReq.Sweet.IsSet) + writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs index c9e4a8bc7120..0dd2d2c9130d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - return new BasquePig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + string classNameParsedValue = className.Value; + + return new BasquePig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index ca7eb413c65b..3452d78a5a89 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -56,37 +57,37 @@ public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public Option ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public Option CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public Option CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public Option SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public Option SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public Option SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -146,12 +147,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string aTTNAME = default; - string capitalCamel = default; - string capitalSnake = default; - string sCAETHFlowPoints = default; - string smallCamel = default; - string smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -169,22 +170,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,25 +193,32 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + Option aTTNAMEParsedValue = new Option(aTTNAME.Value); + Option capitalCamelParsedValue = new Option(capitalCamel.Value); + Option capitalSnakeParsedValue = new Option(capitalSnake.Value); + Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); + Option smallCamelParsedValue = new Option(smallCamel.Value); + Option smallSnakeParsedValue = new Option(smallSnake.Value); + + return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); } /// @@ -237,12 +245,18 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); + if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); + if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); + if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); + if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); + if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 619fc52ce11c..0a668333577c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { Declawed = declawed; OnCreated(); @@ -47,7 +48,7 @@ public Cat(string className, bool declawed, string color = @"red") : base(classN /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public Option Declawed { get; set; } /// /// Returns the string presentation of the object @@ -86,9 +87,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? declawed = default; - string color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -106,14 +107,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -121,16 +122,23 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); + + string classNameParsedValue = className.Value; + Option declawedParsedValue = new Option(declawed.Value.Value); + Option colorParsedValue = new Option(color.Value); + + return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); } /// @@ -157,9 +165,11 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + writer.WriteString("className", cat.ClassName); + if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); + if (cat.Color.IsSet) + writer.WriteString("color", cat.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 6139c3048390..56876bfbe61b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,30 +32,30 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + Id = id; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } - /// /// Gets or Sets Name /// [JsonPropertyName("name")] public string Name { get; set; } + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets additional properties /// @@ -69,8 +70,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -109,8 +110,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -127,12 +128,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +141,19 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - return new Category(id.Value, name); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + + string nameParsedValue = name.Value; + Option idParsedValue = new Option(id.Value.Value); + + return new Category(nameParsedValue, idParsedValue); } /// @@ -173,8 +180,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + writer.WriteString("name", category.Name); + if (category.Id.IsSet) + writer.WriteNumber("id", category.Id.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index da1b80e469d1..5dd0845c9926 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { Name = name; PetType = petType; @@ -105,7 +106,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Returns the string presentation of the object @@ -145,8 +146,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -164,13 +165,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -178,13 +178,16 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + Option nameParsedValue = new Option(name.Value); + Option petTypeParsedValue = new Option(petType.Value.Value); + + return new ChildCat(nameParsedValue, petTypeParsedValue); } /// @@ -211,9 +214,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); - - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index d1c65d368199..cd5f53658194 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { VarClass = varClass; OnCreated(); @@ -45,7 +46,7 @@ public ClassModel(string varClass) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + Option varClassParsedValue = new Option(varClass.Value); + + return new ClassModel(varClassParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClass.IsSet) + writer.WriteString("_class", classModel.VarClass.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 79579247f7e9..7df2ae2c6ba2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs index 84439210bcfc..49531e58d0a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - return new DanishPig(className); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + string classNameParsedValue = className.Value; + + return new DanishPig(classNameParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 191385faf9b6..8f25aa4445dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -44,9 +45,9 @@ public DateOnlyClass(DateTime dateOnlyProperty) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public Option DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -106,7 +107,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -125,7 +126,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -133,10 +134,12 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); + + return new DateOnlyClass(dateOnlyPropertyParsedValue); } /// @@ -163,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyProperty.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 16e3dfe57faa..bddc970c9c6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { Name = name; OnCreated(); @@ -45,7 +46,7 @@ public DeprecatedObject(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + Option nameParsedValue = new Option(name.Value); + + return new DeprecatedObject(nameParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.Name.IsSet) + writer.WriteString("name", deprecatedObject.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 810934b95efe..e83852200af0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,11 +32,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { Breed = breed; OnCreated(); @@ -47,7 +48,7 @@ public Dog(string breed, string className, string color = @"red") : base(classNa /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public Option Breed { get; set; } /// /// Returns the string presentation of the object @@ -86,9 +87,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string breed = default; - string className = default; - string color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -105,14 +106,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -120,16 +121,23 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + + if (breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); + + string classNameParsedValue = className.Value; + Option breedParsedValue = new Option(breed.Value); + Option colorParsedValue = new Option(color.Value); - return new Dog(breed, className, color); + return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); } /// @@ -156,9 +164,11 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + writer.WriteString("className", dog.ClassName); + if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); + if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 68f7676ff91f..1cf583313f64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -51,25 +52,25 @@ public Drawing(Shape mainShape, List shapes, NullableShape nullableShape /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Option MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public Option> Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get; set; } + public Option NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get; set; } + public Option ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -138,10 +139,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape mainShape = default; - List shapes = default; - NullableShape nullableShape = default; - ShapeOrNull shapeOrNull = default; + Option mainShape = default; + Option> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -160,19 +161,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -180,13 +181,16 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + Option mainShapeParsedValue = new Option(mainShape.Value); + Option> shapesParsedValue = new Option>(shapes.Value); + + return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); } /// @@ -213,14 +217,28 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShape.IsSet) + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.Shapes.IsSet) + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShape.IsSet) + if (drawing.NullableShape.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNull.IsSet) + if (drawing.ShapeOrNull.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 7587db930992..5864cc36dda8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -185,7 +186,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public Option> ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -241,8 +242,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -261,13 +262,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -275,13 +275,16 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); + Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + + return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); } /// @@ -308,10 +311,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnum.IsSet) + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs index 94c2361c8810..b1aff0adf0d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index 3e04c40d9467..57bebee610a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,23 +32,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { + EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; - EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -57,6 +58,162 @@ public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } + /// /// Defines EnumInteger /// @@ -415,162 +572,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) [JsonPropertyName("enum_string")] public Option EnumString { get; set; } - /// - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Gets or Sets OuterEnumDefaultValue /// @@ -609,11 +610,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -656,15 +657,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -681,53 +682,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -735,31 +730,43 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + + if (enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; + Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); + Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); + Option enumNumberParsedValue = new Option(enumNumber.Value.Value); + Option enumStringParsedValue = new Option(enumString.Value.Value); + Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); + Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); + Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); + + return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); } /// @@ -786,44 +793,47 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); + if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); + if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else - writer.WriteNull("outerEnumDefaultValue"); - - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + writer.WriteNull("enum_string"); - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); - else + if (enumTest.OuterEnumDefaultValue.IsSet) + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumInteger.IsSet) + { + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValue.IsSet) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnum.IsSet) + if (enumTest.OuterEnum.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 626748ff2097..88e6c4f094b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 905e5452f7c0..2b2bfc46e5dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { SourceURI = sourceURI; OnCreated(); @@ -46,7 +47,7 @@ public File(string sourceURI) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public Option SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +102,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()); break; default: break; @@ -127,10 +128,12 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + Option sourceURIParsedValue = new Option(sourceURI.Value); + + return new File(sourceURIParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURI.IsSet) + writer.WriteString("sourceURI", file.SourceURI.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 722ba3b949f0..e4c63fb2cbc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option> files = default) { File = file; Files = files; @@ -47,13 +48,13 @@ public FileSchemaTestClass(File file, List files) /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public Option File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public Option> Files { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File file = default; - List files = default; + Option file = default; + Option> files = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -141,13 +142,16 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + Option fileParsedValue = new Option(file.Value); + Option> filesParsedValue = new Option>(files.Value); + + return new FileSchemaTestClass(fileParsedValue, filesParsedValue); } /// @@ -174,10 +178,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.File.IsSet) + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.Files.IsSet) + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index 9cfe3b508fe8..318b62f5da62 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { Bar = bar; OnCreated(); @@ -45,7 +46,7 @@ public Foo(string bar = @"bar") /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public Option Bar { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + Option barParsedValue = new Option(bar.Value); + + return new Foo(barParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.Bar.IsSet) + writer.WriteString("bar", foo.Bar.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c8291e8eae5b..e2e0d7cd52d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { VarString = varString; OnCreated(); @@ -45,7 +46,7 @@ public FooGetDefaultResponse(Foo varString) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + Option varStringParsedValue = new Option(varString.Value); + + return new FooGetDefaultResponse(varStringParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarString.IsSet) + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index de2fe5e720e6..f0626b6495e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,9 +32,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -41,8 +44,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -51,11 +52,13 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; + Number = number; + Password = password; + Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -63,8 +66,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi Int32 = int32; Int64 = int64; Integer = integer; - Number = number; - Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -77,12 +78,6 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// @@ -92,110 +87,116 @@ public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTi /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public Option Binary { get; set; } + /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public Option VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public Option VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public Option VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public Option Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public Option Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int Integer { get; set; } - - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } + public Option Integer { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public Option PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public Option PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public Option PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public Option VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public Option UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public Option UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -211,9 +212,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -221,8 +224,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -242,122 +243,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32.IsSet && this.Int32.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32.IsSet && this.Int32.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.Integer.IsSet && this.Integer.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.Integer.IsSet && this.Integer.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslash.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigits.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiter.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarString.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -398,25 +399,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream binary = default; - byte[] varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string password = default; - string patternWithBackslash = default; - string patternWithDigits = default; - string patternWithDigitsAndDelimiter = default; - string varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -433,76 +434,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -510,64 +511,96 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - - if (varByte == null) + if (!varByte.IsSet) throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (date == null) + if (!date.IsSet) throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + + if (varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + + if (varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + + if (int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + + if (int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + + if (integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + + if (patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + byte[] varByteParsedValue = varByte.Value; + DateTime dateParsedValue = date.Value.Value; + decimal numberParsedValue = number.Value.Value; + string passwordParsedValue = password.Value; + Option binaryParsedValue = new Option(binary.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option varDecimalParsedValue = new Option(varDecimal.Value.Value); + Option varDoubleParsedValue = new Option(varDouble.Value.Value); + Option varFloatParsedValue = new Option(varFloat.Value.Value); + Option int32ParsedValue = new Option(int32.Value.Value); + Option int64ParsedValue = new Option(int64.Value.Value); + Option integerParsedValue = new Option(integer.Value.Value); + Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); + Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); + Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); + Option varStringParsedValue = new Option(varString.Value); + Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); + Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); } /// @@ -594,28 +627,43 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + if (formatTest.Binary.IsSet) + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); + if (formatTest.VarDecimal.IsSet) + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); + if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); + if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); + if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); + if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); + if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); + if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); + if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); + if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); + if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); + if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); + if (formatTest.Uuid.IsSet) + writer.WriteString("uuid", formatTest.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index 2e05ffb958a4..b50b03bfbf2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; Color = color; @@ -45,7 +46,7 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; Color = color; @@ -68,7 +69,7 @@ public Fruit(Banana banana, string color) /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -116,7 +117,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -156,7 +157,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -164,14 +165,16 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + + Option colorParsedValue = new Option(color.Value); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, colorParsedValue); if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, colorParsedValue); throw new JsonException(); } @@ -200,7 +203,8 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.Color.IsSet) + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs index aa26d3600c05..75652a1b436e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index 3c2d1ecefc94..ac335a65c61b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple apple, Banana banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { Apple = apple; Banana = banana; @@ -47,18 +48,18 @@ public GmFruit(Apple apple, Banana banana, string color) /// /// Gets or Sets Apple /// - public Apple Apple { get; set; } + public Option Apple { get; set; } /// /// Gets or Sets Banana /// - public Banana Banana { get; set; } + public Option Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public Option Color { get; set; } /// /// Returns the string presentation of the object @@ -106,7 +107,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -146,7 +147,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,10 +155,15 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option colorParsedValue = new Option(color.Value); + + Option appleParsedValue = new Option(apple); + Option bananaParsedValue = new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); } /// @@ -171,16 +177,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -196,7 +202,8 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.Color.IsSet) + writer.WriteString("color", gmFruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7ae4662ed8d4..df79594c7836 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,7 +111,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -128,7 +129,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -136,10 +137,15 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - return new GrandparentAnimal(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + string petTypeParsedValue = petType.Value; + + return new GrandparentAnimal(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 31360d73f754..05d6dc00c0b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { Bar = bar; Foo = foo; @@ -47,13 +48,13 @@ internal HasOnlyReadOnly(string bar, string foo) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public Option Foo { get; } /// /// Gets or Sets additional properties @@ -146,8 +147,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -165,10 +166,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()); break; default: break; @@ -176,13 +177,16 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + Option barParsedValue = new Option(bar.Value); + Option fooParsedValue = new Option(foo.Value); + + return new HasOnlyReadOnly(barParsedValue, fooParsedValue); } /// @@ -209,8 +213,10 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); + if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 8355d97fa097..82ddf5d26c2a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -45,7 +46,7 @@ public HealthCheckResult(string nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get; set; } + public Option NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,7 +154,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessage.IsSet) + if (healthCheckResult.NullableMessage.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 0355613042f2..bfb2e51e08d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -102,8 +103,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -121,10 +122,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -132,13 +133,22 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -165,8 +175,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index 42b0c9cb2cf1..cf07e34fb205 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { Var123List = var123List; OnCreated(); @@ -45,7 +46,7 @@ public List(string var123List) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public Option Var123List { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + Option var123ListParsedValue = new Option(var123List.Value); + + return new List(var123ListParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123List.IsSet) + writer.WriteString("123-list", list.Var123List.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0ad8832af885..41d23030588a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -47,13 +48,13 @@ public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public Option EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public Option UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string escapedLiteralString = default; - string unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,16 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); + Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); + + return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); } /// @@ -172,8 +176,10 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); + if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs index 92011ad0e1d9..6d861cf51efc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -150,7 +151,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; Pig pig = null; Whale whale = null; @@ -207,7 +208,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,22 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); + + string classNameParsedValue = className.Value; + if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, classNameParsedValue); if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, classNameParsedValue); if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index c99356fbf3a8..c6fdd5671ee6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { DirectMap = directMap; IndirectMap = indirectMap; @@ -117,25 +118,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Option> DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Option> IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Option>> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Option> MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -193,10 +194,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary directMap = default; - Dictionary indirectMap = default; - Dictionary> mapMapOfString = default; - Dictionary mapOfEnumString = default; + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -215,19 +216,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -235,19 +236,24 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + Option> directMapParsedValue = new Option>(directMap.Value); + Option> indirectMapParsedValue = new Option>(indirectMap.Value); + Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); + Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + + return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); } /// @@ -274,14 +280,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMap.IsSet) + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMap.IsSet) + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfString.IsSet) + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumString.IsSet) + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 0ed70f02c2db..bd0f20d5fc16 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { DateTime = dateTime; Map = map; @@ -51,25 +52,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public Option DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Option> Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Option UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +104,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -138,10 +139,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -160,19 +161,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -180,19 +181,24 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + Option dateTimeParsedValue = new Option(dateTime.Value.Value); + Option> mapParsedValue = new Option>(map.Value); + Option uuidParsedValue = new Option(uuid.Value.Value); + Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); + + return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); } /// @@ -219,11 +225,15 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); + if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 7969b9ae04ed..8c3506247137 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { VarClass = varClass; Name = name; @@ -47,13 +48,13 @@ public Model200Response(string varClass, int name) /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public Option VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -140,13 +141,16 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + Option varClassParsedValue = new Option(varClass.Value); + Option nameParsedValue = new Option(name.Value.Value); + + return new Model200Response(varClassParsedValue, nameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); + if (model200Response.Name.IsSet) + writer.WriteNumber("name", model200Response.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index 810a6a01b8e9..352915a9b5ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { VarClient = varClient; OnCreated(); @@ -45,7 +46,7 @@ public ModelClient(string varClient) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public Option VarClient { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + Option varClientParsedValue = new Option(varClient.Value); + + return new ModelClient(varClientParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClient.IsSet) + writer.WriteString("client", modelClient.VarClient.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index edcb6b3403c7..25e952643413 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; Property = property; @@ -57,19 +58,19 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public Option Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public Option SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public Option Var123Number { get; } /// /// Gets or Sets additional properties @@ -164,10 +165,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -186,18 +187,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -205,19 +206,27 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) + if (!varName.IsSet) throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + if (var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); + + int varNameParsedValue = varName.Value.Value; + Option propertyParsedValue = new Option(property.Value); + Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); + Option var123NumberParsedValue = new Option(var123Number.Value.Value); + + return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); } /// @@ -244,10 +253,13 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + writer.WriteNumber("name", name.VarName); + if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); + if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); + if (name.Var123Number.IsSet) + writer.WriteNumber("123Number", name.Var123Number.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 83ab7f40b1e8..566cd90fa667 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -141,13 +142,22 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) + if (!aObjVariableobject.IsSet) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (pkiNotificationtestID == null) + if (!pkiNotificationtestID.IsSet) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + List> aObjVariableobjectParsedValue = aObjVariableobject.Value; + int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 5d9de18c4a36..82dd5aa886b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,7 +45,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -67,73 +68,73 @@ public NullableClass(List arrayItemsNullable, Dictionary /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public Option> ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Option> ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get; set; } + public Option> ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get; set; } + public Option> ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public Option BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public Option DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public Option DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public Option IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public Option NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get; set; } + public Option> ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get; set; } + public Option> ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get; set; } + public Option StringProp { get; set; } /// /// Gets or Sets additional properties @@ -220,18 +221,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayItemsNullable = default; - Dictionary objectItemsNullable = default; - List arrayAndItemsNullableProp = default; - List arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary objectAndItemsNullableProp = default; - Dictionary objectNullableProp = default; - string stringProp = default; + Option> arrayItemsNullable = default; + Option> objectItemsNullable = default; + Option> arrayAndItemsNullableProp = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -250,50 +251,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -301,13 +302,16 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); + Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); + + return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -334,45 +338,74 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullable.IsSet) + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullable.IsSet) + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullableProp.IsSet) + if (nullableClass.ArrayAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullableProp.IsSet) + if (nullableClass.ArrayNullableProp.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); + if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); + if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); + if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.ObjectAndItemsNullableProp.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullableProp.IsSet) + if (nullableClass.ObjectNullableProp.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 684109acd50f..6630472d83cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { Uuid = uuid; OnCreated(); @@ -46,7 +47,7 @@ public NullableGuidClass(Guid? uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +102,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -155,11 +156,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.Uuid.IsSet) + if (nullableGuidClass.Uuid.Value != null) + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs index a44c950b81bb..67194a079381 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 3f3cbf4c5059..c54ed6a54175 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { JustNumber = justNumber; OnCreated(); @@ -45,7 +46,7 @@ public NumberOnly(decimal justNumber) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public Option JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +128,12 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + Option justNumberParsedValue = new Option(justNumber.Value.Value); + + return new NumberOnly(justNumberParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumber.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 57a1614f29f4..fb0980df5aa3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +37,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -52,27 +53,27 @@ public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecated /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public Option> Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public Option DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public Option Uuid { get; set; } /// /// Gets or Sets additional properties @@ -130,10 +131,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List bars = default; - DeprecatedObject deprecatedRef = default; - decimal? id = default; - string uuid = default; + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -152,18 +153,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()); break; default: break; @@ -171,19 +172,24 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + Option> barsParsedValue = new Option>(bars.Value); + Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); + Option idParsedValue = new Option(id.Value.Value); + Option uuidParsedValue = new Option(uuid.Value); + + return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); } /// @@ -210,12 +216,16 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.Bars.IsSet) + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRef.IsSet) + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); + if (objectWithDeprecatedFields.Uuid.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs index 91dd67631614..660604e3ef17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index d9755f353b5a..47d090894c79 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +39,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { Id = id; PetId = petId; @@ -143,32 +144,32 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public Option PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public Option Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public Option ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public Option Complete { get; set; } /// /// Gets or Sets additional properties @@ -233,12 +234,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -257,29 +258,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -287,25 +287,32 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + Option idParsedValue = new Option(id.Value.Value); + Option petIdParsedValue = new Option(petId.Value.Value); + Option quantityParsedValue = new Option(quantity.Value.Value); + Option shipDateParsedValue = new Option(shipDate.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option completeParsedValue = new Option(complete.Value.Value); + + return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); } /// @@ -332,18 +339,22 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); - - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); + if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); + if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); + if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); + var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.Complete.IsSet) + writer.WriteBoolean("complete", order.Complete.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index c37883db124b..6c3f344b967d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -49,19 +50,19 @@ public OuterComposite(bool myBoolean, decimal myNumber, string myString) /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public Option MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public Option MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public Option MyString { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -139,14 +140,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,16 +155,20 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + Option myBooleanParsedValue = new Option(myBoolean.Value.Value); + Option myNumberParsedValue = new Option(myNumber.Value.Value); + Option myStringParsedValue = new Option(myString.Value); + + return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); } /// @@ -190,9 +195,12 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); + if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); + if (outerComposite.MyString.IsSet) + writer.WriteString("my_string", outerComposite.MyString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs index a4ec335bb386..47bb6793c6ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7c67db5ddca3..136fb4c54c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 84ea65297ab0..2ed4f18a657e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 983d194a1998..c6a470cc64d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 51d8bee407e0..a2e789f2edef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs index eb0129c6ce0f..52a9b17f7c39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -76,7 +77,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -94,7 +95,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -102,10 +103,15 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) + if (!petType.IsSet) throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - return new ParentPet(petType); + if (petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + string petTypeParsedValue = petType.Value; + + return new ParentPet(petTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 861c306e1544..0dcd9935f9ca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,19 +32,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; + Category = category; + Id = id; Status = status; Tags = tags; OnCreated(); @@ -139,18 +140,6 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("status")] public Option Status { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Category Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public long Id { get; set; } - /// /// Gets or Sets Name /// @@ -164,11 +153,23 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Option Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public Option Id { get; set; } + /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public Option> Tags { get; set; } /// /// Gets or Sets additional properties @@ -184,10 +185,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -228,12 +229,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category category = default; - long? id = default; - string name = default; - List photoUrls = default; - Pet.StatusEnum? status = default; - List tags = default; + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; while (utf8JsonReader.Read()) { @@ -250,30 +251,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -281,25 +281,38 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - - if (name == null) + if (!name.IsSet) throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (photoUrls == null) + if (!photoUrls.IsSet) throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + if (category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + + if (status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + + if (tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + + string nameParsedValue = name.Value; + List photoUrlsParsedValue = photoUrls.Value; + Option categoryParsedValue = new Option(category.Value); + Option idParsedValue = new Option(id.Value.Value); + Option statusParsedValue = new Option(status.Value.Value); + Option> tagsParsedValue = new Option>(tags.Value); + + return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); } /// @@ -326,21 +339,23 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.Category.IsSet) + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.Tags.IsSet) + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs index 8185d643e794..fcc56f4a1389 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -184,7 +185,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); + + string classNameParsedValue = className.Value; + if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, classNameParsedValue); if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, classNameParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 3a89a8716e07..2c2227a22512 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 65f7b8b4536f..ae4d33e381d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -184,7 +185,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index c329eed3266b..664d4eb101fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + + return new QuadrilateralInterface(quadrilateralTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 2c8b4fff43d6..299bcb68898d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { Bar = bar; Baz = baz; @@ -47,13 +48,13 @@ public ReadOnlyFirst(string bar, string baz) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public Option Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public Option Baz { get; set; } /// /// Gets or Sets additional properties @@ -145,8 +146,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -164,10 +165,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()); break; default: break; @@ -175,13 +176,16 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + Option barParsedValue = new Option(bar.Value); + Option bazParsedValue = new Option(baz.Value); + + return new ReadOnlyFirst(barParsedValue, bazParsedValue); } /// @@ -208,8 +212,10 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); + if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..4895eff3b068 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2221 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDateProp = notRequiredNullableDateProp; + NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumString = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringProp = notrequiredNullableStringProp; + NotrequiredNullableUuid = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public Option NotrequiredNotnullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public Option NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public Option NotrequiredNullableEnumInteger { get; set; } + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public Option NotrequiredNullableEnumIntegerOnly { get; set; } + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public Option NotrequiredNullableEnumString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public Option NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public Option NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public Option> NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public Option NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public Option NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public Option NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Option NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public Option NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public Option NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public Option> NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public Option NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public Option NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public Option NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Option NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + + if (requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; + List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; + bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; + DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; + RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; + RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; + OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; + string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; + Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; + int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; + Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); + Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); + Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); + Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); + Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); + Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); + Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); + Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); + Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); + Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); + Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); + List requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; + bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; + DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; + DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; + RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; + RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; + RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; + int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; + OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; + string requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; + Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; + + return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); + if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); + if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); + if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); + if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); + if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); + if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); + if (requiredClass.RequiredNullableArrayOfString != null) + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); + if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.NotrequiredNullableArrayOfString.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); + if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); + if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs index 86e7223ee957..261fdb8d1758 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { VarReturn = varReturn; OnCreated(); @@ -45,7 +46,7 @@ public Return(int varReturn) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public Option VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -127,10 +128,12 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + Option varReturnParsedValue = new Option(varReturn.Value.Value); + + return new Return(varReturnParsedValue); } /// @@ -157,7 +160,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturn.IsSet) + writer.WriteNumber("return", varReturn.VarReturn.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 86effcebe7ae..3ed7cc9a1f4d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { Role = role; RoleUuid = roleUuid; @@ -47,13 +48,13 @@ public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public Option Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Option RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -141,13 +142,16 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + Option roleParsedValue = new Option(role.Value); + Option roleUuidParsedValue = new Option(roleUuid.Value.Value); + + return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); } /// @@ -174,9 +178,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.Role.IsSet) + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuid.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index c7002b77b2e1..dea47cec965a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { Name = name; OnCreated(); @@ -45,7 +46,7 @@ public RolesReportsHashRole(string name) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + Option nameParsedValue = new Option(name.Value); + + return new RolesReportsHashRole(nameParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.Name.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 4151ead57dfb..28832300fbb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + string shapeTypeParsedValue = shapeType.Value; + string triangleTypeParsedValue = triangleType.Value; + + return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs index dae0ef02f966..93c0bfceac47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index de32fa535aec..8268d60aca90 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - return new ShapeInterface(shapeType); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + string shapeTypeParsedValue = shapeType.Value; + + return new ShapeInterface(shapeTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 955461e12024..42c7f891e754 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -133,7 +134,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,19 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); + + string shapeTypeParsedValue = shapeType.Value; + if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 7f0b8a306f80..dc0e716e4104 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -109,8 +110,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,22 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) + if (!quadrilateralType.IsSet) throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (shapeType == null) + if (!shapeType.IsSet) throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + string quadrilateralTypeParsedValue = quadrilateralType.Value; + string shapeTypeParsedValue = shapeType.Value; + + return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); } /// @@ -172,8 +182,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 8328ad3ee121..60097640238f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -47,13 +48,13 @@ public SpecialModelName(string varSpecialModelName, long specialPropertyName) /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public Option VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public Option SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -128,11 +129,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +141,16 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); + Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); + + return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); + if (specialModelName.SpecialPropertyName.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index 6524d75edcf5..47a114ecc78f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { Id = id; Name = name; @@ -47,13 +48,13 @@ public Tag(long id, string name) /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public Option Name { get; set; } /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -129,10 +130,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -140,13 +141,16 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + Option idParsedValue = new Option(id.Value.Value); + Option nameParsedValue = new Option(name.Value); + + return new Tag(idParsedValue, nameParsedValue); } /// @@ -173,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); + if (tag.Name.IsSet) + writer.WriteString("name", tag.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b2e110e79f67..8db7c285f6b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { Value = value; OnCreated(); @@ -45,7 +46,7 @@ public TestCollectionEndingWithWordList(string value) /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public Option Value { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,12 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + Option valueParsedValue = new Option(value.Value); + + return new TestCollectionEndingWithWordList(valueParsedValue); } /// @@ -156,7 +159,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.Value.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 8753edfd9f35..6ea936534a86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -45,7 +46,7 @@ public TestCollectionEndingWithWordListObject(List [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public Option> TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List testCollectionEndingWithWordList = default; + Option> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -119,7 +120,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +128,12 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); + + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); } /// @@ -157,8 +160,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 139e92b4c6a8..4894c12d6f39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { SomeProperty = someProperty; OnCreated(); @@ -45,7 +46,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public Option SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -111,7 +112,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +130,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()); break; default: break; @@ -137,10 +138,12 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + Option somePropertyParsedValue = new Option(someProperty.Value); + + return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); } /// @@ -167,7 +170,8 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs index 814316961f91..d48412119583 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -150,7 +151,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -207,7 +208,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,22 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); + + string triangleTypeParsedValue = triangleType.Value; + if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleTypeParsedValue); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleTypeParsedValue); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleTypeParsedValue); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 6bd1e4303a70..d0552a4dfeaf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -100,7 +101,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,15 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) + if (!triangleType.IsSet) throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - return new TriangleInterface(triangleType); + if (triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + string triangleTypeParsedValue = triangleType.Value; + + return new TriangleInterface(triangleTypeParsedValue); } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index ea527b94ec08..9c0be73daa82 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,7 +45,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -67,78 +68,78 @@ public User(string email, string firstName, long id, string lastName, Object obj /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public Option Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public Option FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public Option Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public Option LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Option ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public Option Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public Option Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public Option UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public Option Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get; set; } + public Option AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get; set; } + public Option AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get; set; } + public Option ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -204,18 +205,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string email = default; - string firstName = default; - long? id = default; - string lastName = default; - Object objectWithNoDeclaredProps = default; - string password = default; - string phone = default; - int? userStatus = default; - string username = default; - Object anyTypeProp = default; - Object anyTypePropNullable = default; - Object objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -233,46 +234,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -280,34 +281,44 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + Option emailParsedValue = new Option(email.Value); + Option firstNameParsedValue = new Option(firstName.Value); + Option idParsedValue = new Option(id.Value.Value); + Option lastNameParsedValue = new Option(lastName.Value); + Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); + Option passwordParsedValue = new Option(password.Value); + Option phoneParsedValue = new Option(phone.Value); + Option userStatusParsedValue = new Option(userStatus.Value.Value); + Option usernameParsedValue = new Option(username.Value); + + return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -334,22 +345,49 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); + if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); + if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); + if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); + if (user.ObjectWithNoDeclaredProps.IsSet) + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); + if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); + if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); + if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); + if (user.AnyTypeProp.IsSet) + if (user.AnyTypeProp.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullable.IsSet) + if (user.AnyTypePropNullable.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullable.IsSet) + if (user.ObjectWithNoDeclaredPropsNullable.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index e633a5c92cf5..67710b37d78a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +36,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; HasBaleen = hasBaleen; @@ -55,13 +56,13 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public Option HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public Option HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -118,9 +119,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -138,15 +139,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -154,16 +155,23 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + if (hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); + + string classNameParsedValue = className.Value; + Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); + Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); + + return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); } /// @@ -190,9 +198,11 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + writer.WriteString("className", whale.ClassName); + if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); + if (whale.HasTeeth.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index eb62c6690959..03c924490df9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +35,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; Type = type; @@ -200,8 +201,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -219,13 +220,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -233,13 +233,19 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) + if (!className.IsSet) throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + if (type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + + string classNameParsedValue = className.Value; + Option typeParsedValue = new Option(type.Value.Value); + + return new Zebra(classNameParsedValue, typeParsedValue); } /// @@ -266,9 +272,8 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); - - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + writer.WriteString("className", zebra.ClassName); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 20e184f02b2b..34a044fb8b13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 7ed6ad24a483..042dcb1ca2ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,7 +34,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -166,7 +167,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -185,9 +186,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -195,10 +195,12 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + + return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); } /// @@ -225,8 +227,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES index cfa6edb1db83..3079e1bed81a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -195,6 +196,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md index 18aa6dd26bc4..45508dddfc61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md @@ -246,6 +246,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..919ae3fc0fe8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1043 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Org.OpenAPITools.Client.FileParameter; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES index b6dffff4f19f..b73f11d50f17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES @@ -75,6 +75,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -194,6 +195,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md index dcfb29678186..7397b3f98161 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md @@ -207,6 +207,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](Quadrilateral.md) - [Model.QuadrilateralInterface](QuadrilateralInterface.md) - [Model.ReadOnlyFirst](ReadOnlyFirst.md) + - [Model.RequiredClass](RequiredClass.md) - [Model.Return](Return.md) - [Model.RolesReportsHash](RolesReportsHash.md) - [Model.RolesReportsHashRole](RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..24f5e2325d28 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,410 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; +using NUnit.Framework; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Test] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Test] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Test] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Test] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Test] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Test] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Test] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Test] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Test] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Test] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Test] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Test] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Test] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Test] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Test] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Test] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Test] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Test] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Test] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Test] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Test] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Test] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Test] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Test] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Test] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Test] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Test] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Test] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Test] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Test] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Test] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Test] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Test] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Test] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Test] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Test] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Test] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + /// + /// Test the property 'RequiredNullableUuid' + /// + [Test] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Test] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Test] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Test] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Test] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Test] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Test] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Test] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..eb89d56999fc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1224 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() { } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RequiredClass); + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + if (input == null) + { + return false; + } + return + ( + this.RequiredNullableIntegerProp == input.RequiredNullableIntegerProp || + (this.RequiredNullableIntegerProp != null && + this.RequiredNullableIntegerProp.Equals(input.RequiredNullableIntegerProp)) + ) && + ( + this.RequiredNotnullableintegerProp == input.RequiredNotnullableintegerProp || + this.RequiredNotnullableintegerProp.Equals(input.RequiredNotnullableintegerProp) + ) && + ( + this.NotRequiredNullableIntegerProp == input.NotRequiredNullableIntegerProp || + (this.NotRequiredNullableIntegerProp != null && + this.NotRequiredNullableIntegerProp.Equals(input.NotRequiredNullableIntegerProp)) + ) && + ( + this.NotRequiredNotnullableintegerProp == input.NotRequiredNotnullableintegerProp || + this.NotRequiredNotnullableintegerProp.Equals(input.NotRequiredNotnullableintegerProp) + ) && + ( + this.RequiredNullableStringProp == input.RequiredNullableStringProp || + (this.RequiredNullableStringProp != null && + this.RequiredNullableStringProp.Equals(input.RequiredNullableStringProp)) + ) && + ( + this.RequiredNotnullableStringProp == input.RequiredNotnullableStringProp || + (this.RequiredNotnullableStringProp != null && + this.RequiredNotnullableStringProp.Equals(input.RequiredNotnullableStringProp)) + ) && + ( + this.NotrequiredNullableStringProp == input.NotrequiredNullableStringProp || + (this.NotrequiredNullableStringProp != null && + this.NotrequiredNullableStringProp.Equals(input.NotrequiredNullableStringProp)) + ) && + ( + this.NotrequiredNotnullableStringProp == input.NotrequiredNotnullableStringProp || + (this.NotrequiredNotnullableStringProp != null && + this.NotrequiredNotnullableStringProp.Equals(input.NotrequiredNotnullableStringProp)) + ) && + ( + this.RequiredNullableBooleanProp == input.RequiredNullableBooleanProp || + (this.RequiredNullableBooleanProp != null && + this.RequiredNullableBooleanProp.Equals(input.RequiredNullableBooleanProp)) + ) && + ( + this.RequiredNotnullableBooleanProp == input.RequiredNotnullableBooleanProp || + this.RequiredNotnullableBooleanProp.Equals(input.RequiredNotnullableBooleanProp) + ) && + ( + this.NotrequiredNullableBooleanProp == input.NotrequiredNullableBooleanProp || + (this.NotrequiredNullableBooleanProp != null && + this.NotrequiredNullableBooleanProp.Equals(input.NotrequiredNullableBooleanProp)) + ) && + ( + this.NotrequiredNotnullableBooleanProp == input.NotrequiredNotnullableBooleanProp || + this.NotrequiredNotnullableBooleanProp.Equals(input.NotrequiredNotnullableBooleanProp) + ) && + ( + this.RequiredNullableDateProp == input.RequiredNullableDateProp || + (this.RequiredNullableDateProp != null && + this.RequiredNullableDateProp.Equals(input.RequiredNullableDateProp)) + ) && + ( + this.RequiredNotNullableDateProp == input.RequiredNotNullableDateProp || + (this.RequiredNotNullableDateProp != null && + this.RequiredNotNullableDateProp.Equals(input.RequiredNotNullableDateProp)) + ) && + ( + this.NotRequiredNullableDateProp == input.NotRequiredNullableDateProp || + (this.NotRequiredNullableDateProp != null && + this.NotRequiredNullableDateProp.Equals(input.NotRequiredNullableDateProp)) + ) && + ( + this.NotRequiredNotnullableDateProp == input.NotRequiredNotnullableDateProp || + (this.NotRequiredNotnullableDateProp != null && + this.NotRequiredNotnullableDateProp.Equals(input.NotRequiredNotnullableDateProp)) + ) && + ( + this.RequiredNotnullableDatetimeProp == input.RequiredNotnullableDatetimeProp || + (this.RequiredNotnullableDatetimeProp != null && + this.RequiredNotnullableDatetimeProp.Equals(input.RequiredNotnullableDatetimeProp)) + ) && + ( + this.RequiredNullableDatetimeProp == input.RequiredNullableDatetimeProp || + (this.RequiredNullableDatetimeProp != null && + this.RequiredNullableDatetimeProp.Equals(input.RequiredNullableDatetimeProp)) + ) && + ( + this.NotrequiredNullableDatetimeProp == input.NotrequiredNullableDatetimeProp || + (this.NotrequiredNullableDatetimeProp != null && + this.NotrequiredNullableDatetimeProp.Equals(input.NotrequiredNullableDatetimeProp)) + ) && + ( + this.NotrequiredNotnullableDatetimeProp == input.NotrequiredNotnullableDatetimeProp || + (this.NotrequiredNotnullableDatetimeProp != null && + this.NotrequiredNotnullableDatetimeProp.Equals(input.NotrequiredNotnullableDatetimeProp)) + ) && + ( + this.RequiredNullableEnumInteger == input.RequiredNullableEnumInteger || + this.RequiredNullableEnumInteger.Equals(input.RequiredNullableEnumInteger) + ) && + ( + this.RequiredNotnullableEnumInteger == input.RequiredNotnullableEnumInteger || + this.RequiredNotnullableEnumInteger.Equals(input.RequiredNotnullableEnumInteger) + ) && + ( + this.NotrequiredNullableEnumInteger == input.NotrequiredNullableEnumInteger || + this.NotrequiredNullableEnumInteger.Equals(input.NotrequiredNullableEnumInteger) + ) && + ( + this.NotrequiredNotnullableEnumInteger == input.NotrequiredNotnullableEnumInteger || + this.NotrequiredNotnullableEnumInteger.Equals(input.NotrequiredNotnullableEnumInteger) + ) && + ( + this.RequiredNullableEnumIntegerOnly == input.RequiredNullableEnumIntegerOnly || + this.RequiredNullableEnumIntegerOnly.Equals(input.RequiredNullableEnumIntegerOnly) + ) && + ( + this.RequiredNotnullableEnumIntegerOnly == input.RequiredNotnullableEnumIntegerOnly || + this.RequiredNotnullableEnumIntegerOnly.Equals(input.RequiredNotnullableEnumIntegerOnly) + ) && + ( + this.NotrequiredNullableEnumIntegerOnly == input.NotrequiredNullableEnumIntegerOnly || + this.NotrequiredNullableEnumIntegerOnly.Equals(input.NotrequiredNullableEnumIntegerOnly) + ) && + ( + this.NotrequiredNotnullableEnumIntegerOnly == input.NotrequiredNotnullableEnumIntegerOnly || + this.NotrequiredNotnullableEnumIntegerOnly.Equals(input.NotrequiredNotnullableEnumIntegerOnly) + ) && + ( + this.RequiredNotnullableEnumString == input.RequiredNotnullableEnumString || + this.RequiredNotnullableEnumString.Equals(input.RequiredNotnullableEnumString) + ) && + ( + this.RequiredNullableEnumString == input.RequiredNullableEnumString || + this.RequiredNullableEnumString.Equals(input.RequiredNullableEnumString) + ) && + ( + this.NotrequiredNullableEnumString == input.NotrequiredNullableEnumString || + this.NotrequiredNullableEnumString.Equals(input.NotrequiredNullableEnumString) + ) && + ( + this.NotrequiredNotnullableEnumString == input.NotrequiredNotnullableEnumString || + this.NotrequiredNotnullableEnumString.Equals(input.NotrequiredNotnullableEnumString) + ) && + ( + this.RequiredNullableOuterEnumDefaultValue == input.RequiredNullableOuterEnumDefaultValue || + this.RequiredNullableOuterEnumDefaultValue.Equals(input.RequiredNullableOuterEnumDefaultValue) + ) && + ( + this.RequiredNotnullableOuterEnumDefaultValue == input.RequiredNotnullableOuterEnumDefaultValue || + this.RequiredNotnullableOuterEnumDefaultValue.Equals(input.RequiredNotnullableOuterEnumDefaultValue) + ) && + ( + this.NotrequiredNullableOuterEnumDefaultValue == input.NotrequiredNullableOuterEnumDefaultValue || + this.NotrequiredNullableOuterEnumDefaultValue.Equals(input.NotrequiredNullableOuterEnumDefaultValue) + ) && + ( + this.NotrequiredNotnullableOuterEnumDefaultValue == input.NotrequiredNotnullableOuterEnumDefaultValue || + this.NotrequiredNotnullableOuterEnumDefaultValue.Equals(input.NotrequiredNotnullableOuterEnumDefaultValue) + ) && + ( + this.RequiredNullableUuid == input.RequiredNullableUuid || + (this.RequiredNullableUuid != null && + this.RequiredNullableUuid.Equals(input.RequiredNullableUuid)) + ) && + ( + this.RequiredNotnullableUuid == input.RequiredNotnullableUuid || + (this.RequiredNotnullableUuid != null && + this.RequiredNotnullableUuid.Equals(input.RequiredNotnullableUuid)) + ) && + ( + this.NotrequiredNullableUuid == input.NotrequiredNullableUuid || + (this.NotrequiredNullableUuid != null && + this.NotrequiredNullableUuid.Equals(input.NotrequiredNullableUuid)) + ) && + ( + this.NotrequiredNotnullableUuid == input.NotrequiredNotnullableUuid || + (this.NotrequiredNotnullableUuid != null && + this.NotrequiredNotnullableUuid.Equals(input.NotrequiredNotnullableUuid)) + ) && + ( + this.RequiredNullableArrayOfString == input.RequiredNullableArrayOfString || + this.RequiredNullableArrayOfString != null && + input.RequiredNullableArrayOfString != null && + this.RequiredNullableArrayOfString.SequenceEqual(input.RequiredNullableArrayOfString) + ) && + ( + this.RequiredNotnullableArrayOfString == input.RequiredNotnullableArrayOfString || + this.RequiredNotnullableArrayOfString != null && + input.RequiredNotnullableArrayOfString != null && + this.RequiredNotnullableArrayOfString.SequenceEqual(input.RequiredNotnullableArrayOfString) + ) && + ( + this.NotrequiredNullableArrayOfString == input.NotrequiredNullableArrayOfString || + this.NotrequiredNullableArrayOfString != null && + input.NotrequiredNullableArrayOfString != null && + this.NotrequiredNullableArrayOfString.SequenceEqual(input.NotrequiredNullableArrayOfString) + ) && + ( + this.NotrequiredNotnullableArrayOfString == input.NotrequiredNotnullableArrayOfString || + this.NotrequiredNotnullableArrayOfString != null && + input.NotrequiredNotnullableArrayOfString != null && + this.NotrequiredNotnullableArrayOfString.SequenceEqual(input.NotrequiredNotnullableArrayOfString) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES index f69e6ba1aba7..0af518f942ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -197,6 +198,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index af827f28641e..c2d5ddeb3539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -221,6 +221,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES index f69e6ba1aba7..0af518f942ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -197,6 +198,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/README.md b/samples/client/petstore/csharp/OpenAPIClientCore/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..9e1e29271350 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1027 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() { } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} From 9a23a30a16befea66faa5912c6c9ad35be2523e4 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Oct 2023 15:13:41 -0400 Subject: [PATCH 05/23] add null check on write, change on exception --- .../generichost/JsonConverter.mustache | 11 +++- .../src/UseSourceGeneration/Model/Activity.cs | 3 + .../ActivityOutputElementRepresentation.cs | 6 ++ .../Model/AdditionalPropertiesClass.cs | 21 +++++++ .../src/UseSourceGeneration/Model/Animal.cs | 8 ++- .../UseSourceGeneration/Model/ApiResponse.cs | 6 ++ .../src/UseSourceGeneration/Model/Apple.cs | 9 +++ .../src/UseSourceGeneration/Model/AppleReq.cs | 5 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 3 + .../Model/ArrayOfNumberOnly.cs | 3 + .../UseSourceGeneration/Model/ArrayTest.cs | 9 +++ .../UseSourceGeneration/Model/BananaReq.cs | 2 +- .../UseSourceGeneration/Model/BasquePig.cs | 5 +- .../Model/Capitalization.cs | 18 ++++++ .../src/UseSourceGeneration/Model/Cat.cs | 8 ++- .../src/UseSourceGeneration/Model/Category.cs | 5 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 3 + .../UseSourceGeneration/Model/ClassModel.cs | 3 + .../Model/ComplexQuadrilateral.cs | 10 +++- .../UseSourceGeneration/Model/DanishPig.cs | 5 +- .../Model/DeprecatedObject.cs | 3 + .../src/UseSourceGeneration/Model/Dog.cs | 11 +++- .../src/UseSourceGeneration/Model/Drawing.cs | 6 ++ .../UseSourceGeneration/Model/EnumArrays.cs | 3 + .../src/UseSourceGeneration/Model/EnumTest.cs | 2 +- .../Model/EquilateralTriangle.cs | 10 +++- .../src/UseSourceGeneration/Model/File.cs | 3 + .../Model/FileSchemaTestClass.cs | 6 ++ .../src/UseSourceGeneration/Model/Foo.cs | 3 + .../Model/FooGetDefaultResponse.cs | 3 + .../UseSourceGeneration/Model/FormatTest.cs | 29 ++++++++-- .../src/UseSourceGeneration/Model/Fruit.cs | 3 + .../src/UseSourceGeneration/Model/GmFruit.cs | 3 + .../Model/GrandparentAnimal.cs | 5 +- .../Model/HasOnlyReadOnly.cs | 6 ++ .../Model/IsoscelesTriangle.cs | 10 +++- .../src/UseSourceGeneration/Model/List.cs | 3 + .../Model/LiteralStringClass.cs | 6 ++ .../src/UseSourceGeneration/Model/Mammal.cs | 5 +- .../src/UseSourceGeneration/Model/MapTest.cs | 12 ++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 3 + .../Model/Model200Response.cs | 3 + .../UseSourceGeneration/Model/ModelClient.cs | 3 + .../src/UseSourceGeneration/Model/Name.cs | 5 +- ...cationtestGetElementsV1ResponseMPayload.cs | 7 ++- .../Model/NullableClass.cs | 6 ++ .../Model/NullableShape.cs | 5 +- .../Model/ObjectWithDeprecatedFields.cs | 9 +++ .../Model/OuterComposite.cs | 3 + .../UseSourceGeneration/Model/ParentPet.cs | 5 +- .../src/UseSourceGeneration/Model/Pet.cs | 16 +++++- .../src/UseSourceGeneration/Model/Pig.cs | 5 +- .../Model/Quadrilateral.cs | 5 +- .../Model/QuadrilateralInterface.cs | 5 +- .../Model/ReadOnlyFirst.cs | 6 ++ .../Model/RequiredClass.cs | 56 +++++++++++-------- .../Model/RolesReportsHash.cs | 3 + .../Model/RolesReportsHashRole.cs | 3 + .../Model/ScaleneTriangle.cs | 10 +++- .../src/UseSourceGeneration/Model/Shape.cs | 5 +- .../Model/ShapeInterface.cs | 5 +- .../UseSourceGeneration/Model/ShapeOrNull.cs | 5 +- .../Model/SimpleQuadrilateral.cs | 10 +++- .../Model/SpecialModelName.cs | 3 + .../src/UseSourceGeneration/Model/Tag.cs | 3 + .../Model/TestCollectionEndingWithWordList.cs | 3 + .../TestCollectionEndingWithWordListObject.cs | 3 + ...lineFreeformAdditionalPropertiesRequest.cs | 3 + .../src/UseSourceGeneration/Model/Triangle.cs | 5 +- .../Model/TriangleInterface.cs | 5 +- .../src/UseSourceGeneration/Model/User.cs | 21 +++++++ .../src/UseSourceGeneration/Model/Whale.cs | 5 +- .../src/UseSourceGeneration/Model/Zebra.cs | 5 +- .../src/Org.OpenAPITools/Model/Activity.cs | 3 + .../ActivityOutputElementRepresentation.cs | 6 ++ .../Model/AdditionalPropertiesClass.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 8 ++- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 6 ++ .../src/Org.OpenAPITools/Model/Apple.cs | 9 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 5 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 3 + .../Model/ArrayOfNumberOnly.cs | 3 + .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 2 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 5 +- .../Org.OpenAPITools/Model/Capitalization.cs | 18 ++++++ .../src/Org.OpenAPITools/Model/Cat.cs | 8 ++- .../src/Org.OpenAPITools/Model/Category.cs | 5 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 3 + .../src/Org.OpenAPITools/Model/ClassModel.cs | 3 + .../Model/ComplexQuadrilateral.cs | 10 +++- .../src/Org.OpenAPITools/Model/DanishPig.cs | 5 +- .../Model/DeprecatedObject.cs | 3 + .../src/Org.OpenAPITools/Model/Dog.cs | 11 +++- .../src/Org.OpenAPITools/Model/Drawing.cs | 6 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../Model/EquilateralTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/File.cs | 3 + .../Model/FileSchemaTestClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Foo.cs | 3 + .../Model/FooGetDefaultResponse.cs | 3 + .../src/Org.OpenAPITools/Model/FormatTest.cs | 29 ++++++++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 3 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 + .../Model/GrandparentAnimal.cs | 5 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 6 ++ .../Model/IsoscelesTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/List.cs | 3 + .../Model/LiteralStringClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Mammal.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 3 + .../Model/Model200Response.cs | 3 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 3 + .../src/Org.OpenAPITools/Model/Name.cs | 5 +- ...cationtestGetElementsV1ResponseMPayload.cs | 7 ++- .../Org.OpenAPITools/Model/NullableClass.cs | 6 ++ .../Org.OpenAPITools/Model/NullableShape.cs | 5 +- .../Model/ObjectWithDeprecatedFields.cs | 9 +++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 5 +- .../src/Org.OpenAPITools/Model/Pet.cs | 16 +++++- .../src/Org.OpenAPITools/Model/Pig.cs | 5 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 5 +- .../Model/QuadrilateralInterface.cs | 5 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 6 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 56 +++++++++++-------- .../Model/RolesReportsHash.cs | 3 + .../Model/RolesReportsHashRole.cs | 3 + .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/Shape.cs | 5 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 5 +- .../Model/SimpleQuadrilateral.cs | 10 +++- .../Model/SpecialModelName.cs | 3 + .../src/Org.OpenAPITools/Model/Tag.cs | 3 + .../Model/TestCollectionEndingWithWordList.cs | 3 + .../TestCollectionEndingWithWordListObject.cs | 3 + ...lineFreeformAdditionalPropertiesRequest.cs | 3 + .../src/Org.OpenAPITools/Model/Triangle.cs | 5 +- .../Model/TriangleInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 5 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 5 +- .../src/Org.OpenAPITools/Model/Activity.cs | 3 + .../ActivityOutputElementRepresentation.cs | 6 ++ .../Model/AdditionalPropertiesClass.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 8 ++- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 6 ++ .../src/Org.OpenAPITools/Model/Apple.cs | 9 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 5 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 3 + .../Model/ArrayOfNumberOnly.cs | 3 + .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 2 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 5 +- .../Org.OpenAPITools/Model/Capitalization.cs | 18 ++++++ .../src/Org.OpenAPITools/Model/Cat.cs | 8 ++- .../src/Org.OpenAPITools/Model/Category.cs | 5 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 3 + .../src/Org.OpenAPITools/Model/ClassModel.cs | 3 + .../Model/ComplexQuadrilateral.cs | 10 +++- .../src/Org.OpenAPITools/Model/DanishPig.cs | 5 +- .../Model/DeprecatedObject.cs | 3 + .../src/Org.OpenAPITools/Model/Dog.cs | 11 +++- .../src/Org.OpenAPITools/Model/Drawing.cs | 6 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../Model/EquilateralTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/File.cs | 3 + .../Model/FileSchemaTestClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Foo.cs | 3 + .../Model/FooGetDefaultResponse.cs | 3 + .../src/Org.OpenAPITools/Model/FormatTest.cs | 29 ++++++++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 3 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 + .../Model/GrandparentAnimal.cs | 5 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 6 ++ .../Model/IsoscelesTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/List.cs | 3 + .../Model/LiteralStringClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Mammal.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 3 + .../Model/Model200Response.cs | 3 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 3 + .../src/Org.OpenAPITools/Model/Name.cs | 5 +- ...cationtestGetElementsV1ResponseMPayload.cs | 7 ++- .../Org.OpenAPITools/Model/NullableClass.cs | 6 ++ .../Org.OpenAPITools/Model/NullableShape.cs | 5 +- .../Model/ObjectWithDeprecatedFields.cs | 9 +++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 5 +- .../src/Org.OpenAPITools/Model/Pet.cs | 16 +++++- .../src/Org.OpenAPITools/Model/Pig.cs | 5 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 5 +- .../Model/QuadrilateralInterface.cs | 5 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 6 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 56 +++++++++++-------- .../Model/RolesReportsHash.cs | 3 + .../Model/RolesReportsHashRole.cs | 3 + .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/Shape.cs | 5 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 5 +- .../Model/SimpleQuadrilateral.cs | 10 +++- .../Model/SpecialModelName.cs | 3 + .../src/Org.OpenAPITools/Model/Tag.cs | 3 + .../Model/TestCollectionEndingWithWordList.cs | 3 + .../TestCollectionEndingWithWordListObject.cs | 3 + ...lineFreeformAdditionalPropertiesRequest.cs | 3 + .../src/Org.OpenAPITools/Model/Triangle.cs | 5 +- .../Model/TriangleInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 5 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 5 +- .../src/Org.OpenAPITools/Model/Adult.cs | 12 ++++ .../src/Org.OpenAPITools/Model/Child.cs | 9 +++ .../src/Org.OpenAPITools/Model/Person.cs | 9 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 3 + .../src/Org.OpenAPITools/Model/Fruit.cs | 3 + .../src/Org.OpenAPITools/Model/Apple.cs | 3 + .../src/Org.OpenAPITools/Model/Fruit.cs | 3 + .../src/Org.OpenAPITools/Model/Activity.cs | 3 + .../ActivityOutputElementRepresentation.cs | 6 ++ .../Model/AdditionalPropertiesClass.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 8 ++- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 6 ++ .../src/Org.OpenAPITools/Model/Apple.cs | 9 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 5 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 3 + .../Model/ArrayOfNumberOnly.cs | 3 + .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++ .../src/Org.OpenAPITools/Model/BananaReq.cs | 2 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 5 +- .../Org.OpenAPITools/Model/Capitalization.cs | 18 ++++++ .../src/Org.OpenAPITools/Model/Cat.cs | 8 ++- .../src/Org.OpenAPITools/Model/Category.cs | 5 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 3 + .../src/Org.OpenAPITools/Model/ClassModel.cs | 3 + .../Model/ComplexQuadrilateral.cs | 10 +++- .../src/Org.OpenAPITools/Model/DanishPig.cs | 5 +- .../Model/DeprecatedObject.cs | 3 + .../src/Org.OpenAPITools/Model/Dog.cs | 11 +++- .../src/Org.OpenAPITools/Model/Drawing.cs | 6 ++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 3 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 2 +- .../Model/EquilateralTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/File.cs | 3 + .../Model/FileSchemaTestClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Foo.cs | 3 + .../Model/FooGetDefaultResponse.cs | 3 + .../src/Org.OpenAPITools/Model/FormatTest.cs | 29 ++++++++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 3 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 + .../Model/GrandparentAnimal.cs | 5 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 6 ++ .../Model/IsoscelesTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/List.cs | 3 + .../Model/LiteralStringClass.cs | 6 ++ .../src/Org.OpenAPITools/Model/Mammal.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 3 + .../Model/Model200Response.cs | 3 + .../src/Org.OpenAPITools/Model/ModelClient.cs | 3 + .../src/Org.OpenAPITools/Model/Name.cs | 5 +- ...cationtestGetElementsV1ResponseMPayload.cs | 7 ++- .../Org.OpenAPITools/Model/NullableClass.cs | 6 ++ .../Org.OpenAPITools/Model/NullableShape.cs | 5 +- .../Model/ObjectWithDeprecatedFields.cs | 9 +++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 5 +- .../src/Org.OpenAPITools/Model/Pet.cs | 16 +++++- .../src/Org.OpenAPITools/Model/Pig.cs | 5 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 5 +- .../Model/QuadrilateralInterface.cs | 5 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 6 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 56 +++++++++++-------- .../Model/RolesReportsHash.cs | 3 + .../Model/RolesReportsHashRole.cs | 3 + .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +++- .../src/Org.OpenAPITools/Model/Shape.cs | 5 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 5 +- .../Model/SimpleQuadrilateral.cs | 10 +++- .../Model/SpecialModelName.cs | 3 + .../src/Org.OpenAPITools/Model/Tag.cs | 3 + .../Model/TestCollectionEndingWithWordList.cs | 3 + .../TestCollectionEndingWithWordListObject.cs | 3 + ...lineFreeformAdditionalPropertiesRequest.cs | 3 + .../src/Org.OpenAPITools/Model/Triangle.cs | 5 +- .../Model/TriangleInterface.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 21 +++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 5 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 5 +- 296 files changed, 1808 insertions(+), 257 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache index 4c3562bca062..5624ac4d7be4 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 @@ -264,7 +264,7 @@ {{#allVars}} {{#required}} if (!{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.IsSet) - throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}), "Property is required for class {{classname}}."); + throw new ArgumentException("Property is required for class {{classname}}.", nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}})); {{/required}} {{/allVars}} @@ -380,6 +380,15 @@ {{#lambda.trimTrailingWithNewLine}} {{#lambda.trimLineBreaks}} {{#allVars}} + {{^isNullable}} + {{#vendorExtensions.x-is-reference-type}} + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} == null) + throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}), "Property is required for class {{classname}}."); + + {{/vendorExtensions.x-is-reference-type}} + {{/isNullable}} + {{/allVars}} + {{#allVars}} {{#isString}} {{^isMap}} {{^isEnum}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index 750fb302de38..70c2219671fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { + if (activity.ActivityOutputs.Value == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + if (activity.ActivityOutputs.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index a5d0b987839c..ec6807f01c97 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -180,6 +180,12 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { + if (activityOutputElementRepresentation.Prop1.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (activityOutputElementRepresentation.Prop1.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index ec1c16f445af..ccf9531a5371 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -286,6 +286,27 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (additionalPropertiesClass.EmptyMap.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.EmptyMap.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index 09e663260160..38294ba531b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -154,7 +154,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + throw new ArgumentException("Property is required for class Animal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); @@ -192,6 +192,12 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.Color.Value == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index d8f266176a94..cdb36f9497a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -197,6 +197,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.Message.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.Type.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + if (apiResponse.Code.IsSet) writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index d04681fc6b76..a44bb3f38a22 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -223,6 +223,15 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.ColorCode.Value == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.Cultivar.Value == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.Origin.Value == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + if (apple.ColorCode.IsSet) writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index e7172305c6af..c0fd3f5c87c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -138,7 +138,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!cultivar.IsSet) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); if (cultivar.Value == null) throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); @@ -176,6 +176,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index c23c004c1310..2b7ca367ca02 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 43ac4fb02974..283f9b8a2c68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfNumberOnly.ArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayOfNumberOnly.ArrayNumber.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 8a7934d7e994..7ca654eb7c2e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -199,6 +199,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { + if (arrayTest.ArrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + if (arrayTest.ArrayArrayOfInteger.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index 398381570349..956ff2d13280 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -139,7 +139,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!lengthCm.IsSet) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); if (lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs index 36b2475b5048..55b363a7d128 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs @@ -131,7 +131,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); @@ -165,6 +165,9 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index 8e01699cdd38..25836dd6b406 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -248,6 +248,24 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { + if (capitalization.ATT_NAME.Value == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + if (capitalization.ATT_NAME.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index 80f8dacff01b..f67a17e7cc85 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -126,7 +126,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + throw new ArgumentException("Property is required for class Cat.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); @@ -168,6 +168,12 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.Color.Value == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) writer.WriteBoolean("declawed", cat.Declawed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index fcd75a7f5dea..8325b95ecea8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -145,7 +145,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + throw new ArgumentException("Property is required for class Category.", nameof(name)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); @@ -183,6 +183,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index ed687584e291..307924f1edd1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -217,6 +217,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { + if (childCat.Name.Value == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + if (childCat.Name.IsSet) writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index c88798083b0c..bf09fee0f873 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { + if (classModel.VarClass.Value == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + if (classModel.VarClass.IsSet) writer.WriteString("_class", classModel.VarClass.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index b47fe8777c83..fb98b56bbcaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -144,10 +144,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); @@ -185,6 +185,12 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs index ecb6dab05823..24e9f0f5cd0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs @@ -131,7 +131,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); @@ -165,6 +165,9 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index 232c363f041c..fb16fd495ced 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { + if (deprecatedObject.Name.Value == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + if (deprecatedObject.Name.IsSet) writer.WriteString("name", deprecatedObject.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index f65ddf23da5d..25acadd86861 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -125,7 +125,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + throw new ArgumentException("Property is required for class Dog.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); @@ -167,6 +167,15 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.Breed.Value == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.Color.Value == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) writer.WriteString("breed", dog.Breed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index 04e1cce6dfec..45e2397b30b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -220,6 +220,12 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { + if (drawing.MainShape.Value == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.Shapes.Value == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + if (drawing.MainShape.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index 5145baec174f..7477523d599c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -314,6 +314,9 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { + if (enumArrays.ArrayEnum.Value == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + if (enumArrays.ArrayEnum.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index 6037e0c9c625..3e8e661a3b59 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -734,7 +734,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!enumStringRequired.IsSet) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); if (enumStringRequired.Value == null) throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index ed4456f8b45c..b3c72164347c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -144,10 +144,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); @@ -185,6 +185,12 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index 5cbe0c075f35..f90379c69520 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { + if (file.SourceURI.Value == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + if (file.SourceURI.IsSet) writer.WriteString("sourceURI", file.SourceURI.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index 4dad3140081c..b62dc9ed4968 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -181,6 +181,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { + if (fileSchemaTestClass.File.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.Files.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + if (fileSchemaTestClass.File.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index d73e09e6bbba..2ee7a6584964 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { + if (foo.Bar.Value == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + if (foo.Bar.IsSet) writer.WriteString("bar", foo.Bar.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index 2ad6b7c70b83..f9a519966634 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { + if (fooGetDefaultResponse.VarString.Value == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + if (fooGetDefaultResponse.VarString.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index fe195993bbb3..35afd27c15d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -515,16 +515,16 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } if (!varByte.IsSet) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); if (!date.IsSet) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); if (!number.IsSet) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); if (!password.IsSet) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); if (varByte.Value == null) throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); @@ -630,6 +630,27 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.Binary.Value == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigits.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarString.Value == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index 918b7391483a..6e503a282d9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -206,6 +206,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index 461d363535ad..ade243e645b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -205,6 +205,9 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { + if (gmFruit.Color.Value == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + if (gmFruit.Color.IsSet) writer.WriteString("color", gmFruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs index 9815d17c0ea9..b80fee0e5b96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs @@ -141,7 +141,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); @@ -175,6 +175,9 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index a8f27b64f352..699915c73c48 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -216,6 +216,12 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { + if (hasOnlyReadOnly.Bar.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.Foo.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + if (hasOnlyReadOnly.Bar.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index b5aca49756b3..5481cb516fc1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -137,10 +137,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); @@ -178,6 +178,12 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index 3b8cfbc2cd49..fccf11624a13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { + if (list.Var123List.Value == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + if (list.Var123List.IsSet) writer.WriteString("123-list", list.Var123List.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 4f1d4af301eb..3937265a2702 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -179,6 +179,12 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { + if (literalStringClass.EscapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + if (literalStringClass.EscapedLiteralString.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs index 332afa725dfb..64a8e749fd03 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs @@ -220,7 +220,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); @@ -278,6 +278,9 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index 2fb12a9ee52e..9fbce04435cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -283,6 +283,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { + if (mapTest.DirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + if (mapTest.DirectMap.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 502b99542df1..bc990df72bca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -228,6 +228,9 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index b477d39c62a3..f71039869f10 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { + if (model200Response.VarClass.Value == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + if (model200Response.VarClass.IsSet) writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index bb34f93835f7..bc4bfe24c489 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { + if (modelClient.VarClient.Value == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + if (modelClient.VarClient.IsSet) writer.WriteString("client", modelClient.VarClient.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 3f573d0d57a4..86f6910e9b31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -210,7 +210,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!varName.IsSet) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + throw new ArgumentException("Property is required for class Name.", nameof(varName)); if (varName.Value == null) throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); @@ -256,6 +256,9 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { + if (name.Property.Value == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) writer.WriteString("property", name.Property.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 92586f0e408f..3ddf16689181 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -146,10 +146,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } if (!aObjVariableobject.IsSet) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); if (!pkiNotificationtestID.IsSet) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); if (aObjVariableobject.Value == null) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); @@ -187,6 +187,9 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 53d3770d3674..b1915bcaf6ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -341,6 +341,12 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { + if (nullableClass.ArrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + if (nullableClass.ArrayItemsNullable.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs index d647fa2b7d6b..46927f581c3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs @@ -197,7 +197,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index e4efafb6b799..1ff0c3b59aa4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -219,6 +219,15 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { + if (objectWithDeprecatedFields.Bars.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRef.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.Uuid.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (objectWithDeprecatedFields.Bars.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index d6a205be554f..b92e3e3fb7c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -198,6 +198,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyString.Value == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + if (outerComposite.MyBoolean.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs index fe10e7c16e4d..591371d2844d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs @@ -107,7 +107,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); @@ -141,6 +141,9 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index ac7334b75eb5..0352d870f169 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -285,10 +285,10 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(name)); if (!photoUrls.IsSet) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); @@ -342,6 +342,18 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.Category.Value == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.Tags.Value == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs index 373e07af5c17..4d67a08b23aa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs @@ -197,7 +197,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + throw new ArgumentException("Property is required for class Pig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs index 90f06442f510..e46a75f3c6e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs @@ -197,7 +197,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs index f5be5a54e6ec..39df3b0b91e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs @@ -131,7 +131,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); @@ -165,6 +165,9 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index 5401ebf74664..53e4b097b424 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -215,6 +215,12 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { + if (readOnlyFirst.Bar.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.Baz.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + if (readOnlyFirst.Bar.IsSet) writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs index 879d94370323..2d6e5bc50135 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -1860,70 +1860,70 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); if (!requiredNotnullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); if (!requiredNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); if (!requiredNullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); if (!requiredNullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); if (!requiredNullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); if (requiredNotNullableDateProp.Value == null) throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); @@ -2052,6 +2052,18 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index 1c0423b6f186..d05426562dd4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -181,6 +181,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHash.Role.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + if (rolesReportsHash.Role.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 2bcf1d4558e5..0b6e020ef738 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHashRole.Name.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + if (rolesReportsHashRole.Name.IsSet) writer.WriteString("name", rolesReportsHashRole.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index d5c64c20b379..dc7b4c54175f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -144,10 +144,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); @@ -185,6 +185,12 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs index b94a031027f9..39e5a1dbbd32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs @@ -197,7 +197,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs index f67927f922cd..c013ddca885c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs @@ -131,7 +131,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); @@ -165,6 +165,9 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs index 33d369e1fe47..56a97dde8965 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs @@ -197,7 +197,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); @@ -247,6 +247,9 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index 42eb7292b720..92661400a19f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -144,10 +144,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); @@ -185,6 +185,12 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 456b9d7d397b..27384e659ef4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { + if (specialModelName.VarSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + if (specialModelName.VarSpecialModelName.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index 25d118a72597..834d33968324 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.Name.Value == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + if (tag.Id.IsSet) writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index 1bc93e12e0af..f2ffac9551ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordList.Value.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + if (testCollectionEndingWithWordList.Value.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index 36e7b5632583..e9522dba90b4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -163,6 +163,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 278edcd2fbbe..be74347d46f0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -173,6 +173,9 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs index c15d4f77ab67..960e47030383 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs @@ -220,7 +220,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); @@ -278,6 +278,9 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs index 45443f13dac8..3aaf01207b70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs @@ -131,7 +131,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); @@ -165,6 +165,9 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 6b183800d869..be451156141e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -348,6 +348,27 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { + if (user.Email.Value == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstName.Value == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastName.Value == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.Password.Value == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.Phone.Value == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.Username.Value == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.Email.IsSet) writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index 2b0496853cef..7dc8e1d34af5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -159,7 +159,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + throw new ArgumentException("Property is required for class Whale.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); @@ -201,6 +201,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 808fd31844c6..9cf7004bb77a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -237,7 +237,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); @@ -275,6 +275,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index 7872f668a3aa..b9f9fedaa5cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { + if (activity.ActivityOutputs.Value == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + if (activity.ActivityOutputs.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 49a721261b9f..a51e15fc5399 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -179,6 +179,12 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { + if (activityOutputElementRepresentation.Prop1.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (activityOutputElementRepresentation.Prop1.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 1c8d83f25c11..5629ced55a8e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -285,6 +285,27 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (additionalPropertiesClass.EmptyMap.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.EmptyMap.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 301eff4963a1..1469424d45ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -153,7 +153,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + throw new ArgumentException("Property is required for class Animal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); @@ -191,6 +191,12 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.Color.Value == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index e203a8c21ed1..c25d4c6a0d95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -196,6 +196,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.Message.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.Type.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + if (apiResponse.Code.IsSet) writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index 1ae7d69315d3..f7660b3d0c60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -222,6 +222,15 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.ColorCode.Value == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.Cultivar.Value == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.Origin.Value == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + if (apple.ColorCode.IsSet) writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 82243cc33393..4213752d722a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -137,7 +137,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!cultivar.IsSet) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); if (cultivar.Value == null) throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); @@ -175,6 +175,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 707b2149e429..8963a6632ca7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index aac4f72bb49d..71a99803b701 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfNumberOnly.ArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayOfNumberOnly.ArrayNumber.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index a373fb4c98ac..24fefcddbc98 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -198,6 +198,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { + if (arrayTest.ArrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + if (arrayTest.ArrayArrayOfInteger.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index 4e251b432925..f83e34586321 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -138,7 +138,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!lengthCm.IsSet) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); if (lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 2de32b6365ab..5ec466600efb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -130,7 +130,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); @@ -164,6 +164,9 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 4279fdfdaeab..24a33a3e99b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -247,6 +247,24 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { + if (capitalization.ATT_NAME.Value == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + if (capitalization.ATT_NAME.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 73d0e6a2b804..5842f853a956 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -125,7 +125,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + throw new ArgumentException("Property is required for class Cat.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); @@ -167,6 +167,12 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.Color.Value == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) writer.WriteBoolean("declawed", cat.Declawed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 24af32a1b017..94bee4a895d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -144,7 +144,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + throw new ArgumentException("Property is required for class Category.", nameof(name)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); @@ -182,6 +182,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index c69ca489801e..63f4f5cff931 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -216,6 +216,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { + if (childCat.Name.Value == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + if (childCat.Name.IsSet) writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 8f8ef27d7cd4..9ed3c6423d1c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { + if (classModel.VarClass.Value == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + if (classModel.VarClass.IsSet) writer.WriteString("_class", classModel.VarClass.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 80732f5e59e3..32690611673e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -143,10 +143,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); @@ -184,6 +184,12 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index f22b5e7f65b2..8699f7daf334 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -130,7 +130,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); @@ -164,6 +164,9 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 2358e4779994..19468560680b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { + if (deprecatedObject.Name.Value == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + if (deprecatedObject.Name.IsSet) writer.WriteString("name", deprecatedObject.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 5e77f63cda9e..68701d408fd8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -124,7 +124,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + throw new ArgumentException("Property is required for class Dog.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); @@ -166,6 +166,15 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.Breed.Value == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.Color.Value == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) writer.WriteString("breed", dog.Breed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 2fa3b6ca9d34..683ea15d0701 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -219,6 +219,12 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { + if (drawing.MainShape.Value == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.Shapes.Value == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + if (drawing.MainShape.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index d27296996989..2364179c0559 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -313,6 +313,9 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { + if (enumArrays.ArrayEnum.Value == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + if (enumArrays.ArrayEnum.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 05fc1782649a..52a66c3fe75f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -733,7 +733,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!enumStringRequired.IsSet) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); if (enumStringRequired.Value == null) throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 0b058d0684f8..15c3eab96ef2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -143,10 +143,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); @@ -184,6 +184,12 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index cbd4d00f0760..cb6214ed3f0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { + if (file.SourceURI.Value == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + if (file.SourceURI.IsSet) writer.WriteString("sourceURI", file.SourceURI.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 30920b343574..9d370fa10baa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -180,6 +180,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { + if (fileSchemaTestClass.File.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.Files.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + if (fileSchemaTestClass.File.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index 3607727a623d..59eb60db9853 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { + if (foo.Bar.Value == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + if (foo.Bar.IsSet) writer.WriteString("bar", foo.Bar.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 11517251dbd7..c18d6afa90e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { + if (fooGetDefaultResponse.VarString.Value == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + if (fooGetDefaultResponse.VarString.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 395988c3f931..7ecea7969f81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -514,16 +514,16 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } if (!varByte.IsSet) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); if (!date.IsSet) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); if (!number.IsSet) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); if (!password.IsSet) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); if (varByte.Value == null) throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); @@ -629,6 +629,27 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.Binary.Value == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigits.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarString.Value == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 797aa4ea71bd..9f734a97b691 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -205,6 +205,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index b743db6ecef8..600018e5f77f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -204,6 +204,9 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { + if (gmFruit.Color.Value == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + if (gmFruit.Color.IsSet) writer.WriteString("color", gmFruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 6a72c0ffcb18..5c2b20cd6e73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -140,7 +140,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); @@ -174,6 +174,9 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 1396f23f7929..e692dc60b47f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -215,6 +215,12 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { + if (hasOnlyReadOnly.Bar.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.Foo.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + if (hasOnlyReadOnly.Bar.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index e57effbd4921..7fd8fa409bc5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -136,10 +136,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); @@ -177,6 +177,12 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index ebb73e8b280b..7d80e50a7245 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { + if (list.Var123List.Value == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + if (list.Var123List.IsSet) writer.WriteString("123-list", list.Var123List.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index d73d542953af..8d5a67d38e70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -178,6 +178,12 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { + if (literalStringClass.EscapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + if (literalStringClass.EscapedLiteralString.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index 72b585becee7..e861f1c1432c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -219,7 +219,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); @@ -277,6 +277,9 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index e0edd3018aea..41a63a364d45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -282,6 +282,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { + if (mapTest.DirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + if (mapTest.DirectMap.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index e39cc6d770c0..19476345ce3b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -227,6 +227,9 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index ecb61e131a62..ec015ad08c1e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -179,6 +179,9 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { + if (model200Response.VarClass.Value == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + if (model200Response.VarClass.IsSet) writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index e53992d67f19..5fcd1fcca67d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { + if (modelClient.VarClient.Value == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + if (modelClient.VarClient.IsSet) writer.WriteString("client", modelClient.VarClient.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 4a49796384a0..d8960c3986e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -209,7 +209,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!varName.IsSet) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + throw new ArgumentException("Property is required for class Name.", nameof(varName)); if (varName.Value == null) throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); @@ -255,6 +255,9 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { + if (name.Property.Value == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) writer.WriteString("property", name.Property.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 2497fc35489e..1159c715cd41 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -145,10 +145,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } if (!aObjVariableobject.IsSet) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); if (!pkiNotificationtestID.IsSet) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); if (aObjVariableobject.Value == null) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); @@ -186,6 +186,9 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index c37e7b637e6e..845ab19c2d86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -340,6 +340,12 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { + if (nullableClass.ArrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + if (nullableClass.ArrayItemsNullable.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index 076b7dea59d3..02a1e7ed5502 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -196,7 +196,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); @@ -246,6 +246,9 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index ce4ba8ffc363..f412d58b602e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -218,6 +218,15 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { + if (objectWithDeprecatedFields.Bars.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRef.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.Uuid.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (objectWithDeprecatedFields.Bars.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 52015f58fac2..27cf28b6f740 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -197,6 +197,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyString.Value == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + if (outerComposite.MyBoolean.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index a580e1d388c3..9ae0e661c71f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -106,7 +106,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); @@ -140,6 +140,9 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 368758b4b03e..c4f8ab64ae18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -284,10 +284,10 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(name)); if (!photoUrls.IsSet) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); @@ -341,6 +341,18 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.Category.Value == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.Tags.Value == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index 38fe1cf1ee43..e88caaa7862d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -196,7 +196,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + throw new ArgumentException("Property is required for class Pig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); @@ -246,6 +246,9 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 3919b91b28af..933da7c6dce7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -196,7 +196,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); @@ -246,6 +246,9 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 9e060848efe1..b9bfac847eb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -130,7 +130,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); @@ -164,6 +164,9 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 7cd791af2900..feb6a6defa21 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -214,6 +214,12 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { + if (readOnlyFirst.Bar.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.Baz.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + if (readOnlyFirst.Bar.IsSet) writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index 05a82fc1e0ab..838666fac69d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1859,70 +1859,70 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); if (!requiredNotnullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); if (!requiredNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); if (!requiredNullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); if (!requiredNullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); if (!requiredNullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); if (requiredNotNullableDateProp.Value == null) throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); @@ -2051,6 +2051,18 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b928d426dd35..c50af5ccb341 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHash.Role.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + if (rolesReportsHash.Role.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index b038a54c8ddb..3b9e8d5d172c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHashRole.Name.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + if (rolesReportsHashRole.Name.IsSet) writer.WriteString("name", rolesReportsHashRole.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index fe7e8e10a802..aba9e8e50bbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -143,10 +143,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); @@ -184,6 +184,12 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index 1005f0ec914f..e4d6646dc4c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -196,7 +196,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); @@ -246,6 +246,9 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index ccc203d62dc8..9a9d2701e0bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -130,7 +130,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); @@ -164,6 +164,9 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index fbc7ce7ea067..5b3dd56409eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -196,7 +196,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); @@ -246,6 +246,9 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 0f28ae26f825..759916fc89bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -143,10 +143,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); @@ -184,6 +184,12 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index e0c92a2bd95e..61a55b082147 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -179,6 +179,9 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { + if (specialModelName.VarSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + if (specialModelName.VarSpecialModelName.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index a14d267861f7..5225b599634b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -179,6 +179,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.Name.Value == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + if (tag.Id.IsSet) writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index cea6972f8c71..da2ce0a17c4b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordList.Value.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + if (testCollectionEndingWithWordList.Value.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5de7d3475de1..6a0935dd35d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 88dd258c515c..237a67c659d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -172,6 +172,9 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 8f9b50ad5cbc..7bfd7ebaa77f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -219,7 +219,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); @@ -277,6 +277,9 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index 16648dc65aa8..2813cefdcfbb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -130,7 +130,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); @@ -164,6 +164,9 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 34f74e862a83..575099e5cb81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -347,6 +347,27 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { + if (user.Email.Value == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstName.Value == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastName.Value == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.Password.Value == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.Phone.Value == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.Username.Value == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.Email.IsSet) writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 6c9b65044d5c..1430d60b5606 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -158,7 +158,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + throw new ArgumentException("Property is required for class Whale.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); @@ -200,6 +200,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index 7d7898ac1bc6..f61217b8b6e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -236,7 +236,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); @@ -274,6 +274,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 7cca29511188..8d49c1b094c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { + if (activity.ActivityOutputs.Value == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + if (activity.ActivityOutputs.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 1fd3203e3bf6..e471b77cdb4b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -177,6 +177,12 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { + if (activityOutputElementRepresentation.Prop1.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (activityOutputElementRepresentation.Prop1.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 155396ce0faf..e4580e3489eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -283,6 +283,27 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (additionalPropertiesClass.EmptyMap.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.EmptyMap.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 2037c7de4834..b7fd25d28f73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -151,7 +151,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + throw new ArgumentException("Property is required for class Animal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); @@ -189,6 +189,12 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.Color.Value == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 499ca6fa56a3..84f0343f54b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -194,6 +194,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.Message.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.Type.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + if (apiResponse.Code.IsSet) writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 9757102185ff..ca0904429525 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -220,6 +220,15 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.ColorCode.Value == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.Cultivar.Value == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.Origin.Value == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + if (apple.ColorCode.IsSet) writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index 9470aafaabfc..73382613db6d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -135,7 +135,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!cultivar.IsSet) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); if (cultivar.Value == null) throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); @@ -173,6 +173,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 03aeed86846c..2e8732df9d7b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 8765bb66ccb9..d05e04d3f1d3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfNumberOnly.ArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayOfNumberOnly.ArrayNumber.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index c878e5fbb610..3c3b95bfaeb7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -196,6 +196,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { + if (arrayTest.ArrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + if (arrayTest.ArrayArrayOfInteger.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 52e5f2fea76f..9053162dbb5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -136,7 +136,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!lengthCm.IsSet) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); if (lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index 0dd2d2c9130d..6bba0c922377 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -128,7 +128,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index 3452d78a5a89..d2fb048e6a06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -245,6 +245,24 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { + if (capitalization.ATT_NAME.Value == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + if (capitalization.ATT_NAME.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 0a668333577c..2e71acf4de5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -123,7 +123,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + throw new ArgumentException("Property is required for class Cat.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); @@ -165,6 +165,12 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.Color.Value == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) writer.WriteBoolean("declawed", cat.Declawed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 56876bfbe61b..1db576266dd2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -142,7 +142,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + throw new ArgumentException("Property is required for class Category.", nameof(name)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 5dd0845c9926..5ae93a88b79e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -214,6 +214,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { + if (childCat.Name.Value == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + if (childCat.Name.IsSet) writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index cd5f53658194..d0aa150655d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { + if (classModel.VarClass.Value == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + if (classModel.VarClass.IsSet) writer.WriteString("_class", classModel.VarClass.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 7df2ae2c6ba2..1e2523ee03cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -141,10 +141,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 49531e58d0a3..0c7b565c1bb1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -128,7 +128,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index bddc970c9c6b..e8c1b2b516ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { + if (deprecatedObject.Name.Value == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + if (deprecatedObject.Name.IsSet) writer.WriteString("name", deprecatedObject.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index e83852200af0..feee96455e28 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -122,7 +122,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + throw new ArgumentException("Property is required for class Dog.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); @@ -164,6 +164,15 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.Breed.Value == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.Color.Value == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) writer.WriteString("breed", dog.Breed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index 1cf583313f64..aab2bfe5fa5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -217,6 +217,12 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { + if (drawing.MainShape.Value == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.Shapes.Value == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + if (drawing.MainShape.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 5864cc36dda8..e89d8ebabcec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -311,6 +311,9 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { + if (enumArrays.ArrayEnum.Value == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + if (enumArrays.ArrayEnum.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 57bebee610a6..838889a733ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -731,7 +731,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!enumStringRequired.IsSet) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); if (enumStringRequired.Value == null) throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 88e6c4f094b9..301beabda96e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -141,10 +141,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index 2b2bfc46e5dd..9655d5cd5b6d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { + if (file.SourceURI.Value == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + if (file.SourceURI.IsSet) writer.WriteString("sourceURI", file.SourceURI.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e4c63fb2cbc6..97249c594263 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -178,6 +178,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { + if (fileSchemaTestClass.File.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.Files.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + if (fileSchemaTestClass.File.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index 318b62f5da62..b4f1a36c4f8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { + if (foo.Bar.Value == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + if (foo.Bar.IsSet) writer.WriteString("bar", foo.Bar.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index e2e0d7cd52d7..4dc68e62b6e4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { + if (fooGetDefaultResponse.VarString.Value == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + if (fooGetDefaultResponse.VarString.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index f0626b6495e7..dc5a541db248 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -512,16 +512,16 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } if (!varByte.IsSet) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); if (!date.IsSet) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); if (!number.IsSet) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); if (!password.IsSet) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); if (varByte.Value == null) throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); @@ -627,6 +627,27 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.Binary.Value == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigits.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarString.Value == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index b50b03bfbf2f..0ecd4f389c9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -203,6 +203,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index ac335a65c61b..e46437a88bc5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -202,6 +202,9 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { + if (gmFruit.Color.Value == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + if (gmFruit.Color.IsSet) writer.WriteString("color", gmFruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index df79594c7836..7f03cc930b02 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -138,7 +138,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); @@ -172,6 +172,9 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 05d6dc00c0b2..9a734ddca781 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -213,6 +213,12 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { + if (hasOnlyReadOnly.Bar.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.Foo.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + if (hasOnlyReadOnly.Bar.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index bfb2e51e08d0..b121190352ca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -134,10 +134,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); @@ -175,6 +175,12 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index cf07e34fb205..aaace3024a91 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { + if (list.Var123List.Value == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + if (list.Var123List.IsSet) writer.WriteString("123-list", list.Var123List.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 41d23030588a..467e0d15e310 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -176,6 +176,12 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { + if (literalStringClass.EscapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + if (literalStringClass.EscapedLiteralString.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 6d861cf51efc..4b47f18e5ac7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -217,7 +217,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); @@ -275,6 +275,9 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index c6fdd5671ee6..6a9e14232f95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -280,6 +280,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { + if (mapTest.DirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + if (mapTest.DirectMap.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index bd0f20d5fc16..5f111bb44429 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -225,6 +225,9 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 8c3506247137..6f115400c61a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { + if (model200Response.VarClass.Value == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + if (model200Response.VarClass.IsSet) writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index 352915a9b5ee..e8a6cc98c5cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { + if (modelClient.VarClient.Value == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + if (modelClient.VarClient.IsSet) writer.WriteString("client", modelClient.VarClient.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index 25e952643413..b0a05aa476ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -207,7 +207,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!varName.IsSet) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + throw new ArgumentException("Property is required for class Name.", nameof(varName)); if (varName.Value == null) throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); @@ -253,6 +253,9 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { + if (name.Property.Value == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) writer.WriteString("property", name.Property.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 566cd90fa667..867c76a641df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -143,10 +143,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } if (!aObjVariableobject.IsSet) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); if (!pkiNotificationtestID.IsSet) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); if (aObjVariableobject.Value == null) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); @@ -184,6 +184,9 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 82dd5aa886b6..71b9e38b1348 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -338,6 +338,12 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { + if (nullableClass.ArrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + if (nullableClass.ArrayItemsNullable.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index 67194a079381..b9a9262817dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -194,7 +194,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index fb0980df5aa3..5e6872c85ad4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -216,6 +216,15 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { + if (objectWithDeprecatedFields.Bars.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRef.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.Uuid.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (objectWithDeprecatedFields.Bars.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 6c3f344b967d..9eb3c490bfc2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -195,6 +195,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyString.Value == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + if (outerComposite.MyBoolean.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index 52a9b17f7c39..eed898ba2b31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -104,7 +104,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); @@ -138,6 +138,9 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 0dcd9935f9ca..41b0a8cff019 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -282,10 +282,10 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(name)); if (!photoUrls.IsSet) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); @@ -339,6 +339,18 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.Category.Value == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.Tags.Value == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index fcc56f4a1389..25983ae01515 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -194,7 +194,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + throw new ArgumentException("Property is required for class Pig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index ae4d33e381d2..07e96cf8bb56 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -194,7 +194,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 664d4eb101fa..0804077cd4c8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -128,7 +128,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 299bcb68898d..d5164a7bb944 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -212,6 +212,12 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { + if (readOnlyFirst.Bar.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.Baz.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + if (readOnlyFirst.Bar.IsSet) writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 4895eff3b068..e0b48de98e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1857,70 +1857,70 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); if (!requiredNotnullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); if (!requiredNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); if (!requiredNullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); if (!requiredNullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); if (!requiredNullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); if (requiredNotNullableDateProp.Value == null) throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); @@ -2049,6 +2049,18 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 3ed7cc9a1f4d..54b27bd0611e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -178,6 +178,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHash.Role.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + if (rolesReportsHash.Role.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index dea47cec965a..ef1ad83c5ac4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHashRole.Name.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + if (rolesReportsHashRole.Name.IsSet) writer.WriteString("name", rolesReportsHashRole.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 28832300fbb9..cfa91de91dce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -141,10 +141,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index 93c0bfceac47..a65c260c9efb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -194,7 +194,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 8268d60aca90..526250148c57 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -128,7 +128,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 42c7f891e754..ccfbe3817dea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -194,7 +194,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index dc0e716e4104..1541483535d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -141,10 +141,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 60097640238f..b29573623098 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { + if (specialModelName.VarSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + if (specialModelName.VarSpecialModelName.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index 47a114ecc78f..f3897baf2691 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.Name.Value == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + if (tag.Id.IsSet) writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 8db7c285f6b0..f52b9e4a2b54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordList.Value.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + if (testCollectionEndingWithWordList.Value.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 6ea936534a86..4227a82c141a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 4894c12d6f39..66ff4d3f740d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -170,6 +170,9 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index d48412119583..d3f217b6df34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -217,7 +217,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); @@ -275,6 +275,9 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index d0552a4dfeaf..728872627f36 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -128,7 +128,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index 9c0be73daa82..2b736793356d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -345,6 +345,27 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { + if (user.Email.Value == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstName.Value == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastName.Value == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.Password.Value == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.Phone.Value == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.Username.Value == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.Email.IsSet) writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index 67710b37d78a..fd1678274743 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -156,7 +156,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + throw new ArgumentException("Property is required for class Whale.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); @@ -198,6 +198,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 03c924490df9..b975b1b1d987 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -234,7 +234,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); @@ -272,6 +272,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index ba5f482115ed..cb21d8fbac2e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -173,6 +173,18 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { + if (adult.Children.Value == null) + throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + + if (adult.FirstName.Value == null) + throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + + if (adult.LastName.Value == null) + throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + + if (adult.Type.Value == null) + throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult."); + if (adult.Children.IsSet) writer.WritePropertyName("children"); JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index c27a2df57c1a..2b0f5675b0e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -191,6 +191,15 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { + if (child.FirstName.Value == null) + throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + + if (child.LastName.Value == null) + throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + + if (child.Type.Value == null) + throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child."); + if (child.Age.IsSet) writer.WriteNumber("age", child.Age.Value); if (child.FirstName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index dc35b07c4568..7054da1d52ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -205,6 +205,15 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { + if (person.FirstName.Value == null) + throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + + if (person.LastName.Value == null) + throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + + if (person.Type.Value == null) + throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person."); + if (person.FirstName.IsSet) writer.WriteString("firstName", person.FirstName.Value); if (person.LastName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index 4113fc73e30e..c7db177bf146 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.Kind.Value == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + if (apple.Kind.IsSet) writer.WriteString("kind", apple.Kind.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index d6075748f0f4..cd5112a8166f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -211,6 +211,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index 4113fc73e30e..c7db177bf146 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -161,6 +161,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.Kind.Value == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + if (apple.Kind.IsSet) writer.WriteString("kind", apple.Kind.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index fff91553d610..b1b0e8742ac8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -212,6 +212,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 7cca29511188..8d49c1b094c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { + if (activity.ActivityOutputs.Value == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + if (activity.ActivityOutputs.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 1fd3203e3bf6..e471b77cdb4b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -177,6 +177,12 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { + if (activityOutputElementRepresentation.Prop1.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2.Value == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (activityOutputElementRepresentation.Prop1.IsSet) writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 155396ce0faf..e4580e3489eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -283,6 +283,27 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (additionalPropertiesClass.EmptyMap.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapProperty.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.EmptyMap.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 2037c7de4834..b7fd25d28f73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -151,7 +151,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + throw new ArgumentException("Property is required for class Animal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); @@ -189,6 +189,12 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.Color.Value == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 499ca6fa56a3..84f0343f54b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -194,6 +194,12 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { + if (apiResponse.Message.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.Type.Value == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + if (apiResponse.Code.IsSet) writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 9757102185ff..ca0904429525 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -220,6 +220,15 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { + if (apple.ColorCode.Value == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.Cultivar.Value == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.Origin.Value == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + if (apple.ColorCode.IsSet) writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index 9470aafaabfc..73382613db6d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -135,7 +135,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!cultivar.IsSet) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); if (cultivar.Value == null) throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); @@ -173,6 +173,9 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 03aeed86846c..2e8732df9d7b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 8765bb66ccb9..d05e04d3f1d3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { + if (arrayOfNumberOnly.ArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayOfNumberOnly.ArrayNumber.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index c878e5fbb610..3c3b95bfaeb7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -196,6 +196,15 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { + if (arrayTest.ArrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + if (arrayTest.ArrayArrayOfInteger.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index 52e5f2fea76f..9053162dbb5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -136,7 +136,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!lengthCm.IsSet) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); if (lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs index 0dd2d2c9130d..6bba0c922377 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -128,7 +128,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index 3452d78a5a89..d2fb048e6a06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -245,6 +245,24 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { + if (capitalization.ATT_NAME.Value == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamel.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnake.Value == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + if (capitalization.ATT_NAME.IsSet) writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 0a668333577c..2e71acf4de5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -123,7 +123,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + throw new ArgumentException("Property is required for class Cat.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); @@ -165,6 +165,12 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.Color.Value == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) writer.WriteBoolean("declawed", cat.Declawed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 56876bfbe61b..1db576266dd2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -142,7 +142,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + throw new ArgumentException("Property is required for class Category.", nameof(name)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); @@ -180,6 +180,9 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index 5dd0845c9926..5ae93a88b79e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -214,6 +214,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { + if (childCat.Name.Value == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + if (childCat.Name.IsSet) writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index cd5f53658194..d0aa150655d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { + if (classModel.VarClass.Value == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + if (classModel.VarClass.IsSet) writer.WriteString("_class", classModel.VarClass.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 7df2ae2c6ba2..1e2523ee03cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -141,10 +141,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs index 49531e58d0a3..0c7b565c1bb1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -128,7 +128,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index bddc970c9c6b..e8c1b2b516ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { + if (deprecatedObject.Name.Value == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + if (deprecatedObject.Name.IsSet) writer.WriteString("name", deprecatedObject.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index e83852200af0..feee96455e28 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -122,7 +122,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + throw new ArgumentException("Property is required for class Dog.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); @@ -164,6 +164,15 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.Breed.Value == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.Color.Value == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) writer.WriteString("breed", dog.Breed.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 1cf583313f64..aab2bfe5fa5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -217,6 +217,12 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { + if (drawing.MainShape.Value == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.Shapes.Value == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + if (drawing.MainShape.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 5864cc36dda8..e89d8ebabcec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -311,6 +311,9 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { + if (enumArrays.ArrayEnum.Value == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + if (enumArrays.ArrayEnum.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index 57bebee610a6..838889a733ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -731,7 +731,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!enumStringRequired.IsSet) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); if (enumStringRequired.Value == null) throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 88e6c4f094b9..301beabda96e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -141,10 +141,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 2b2bfc46e5dd..9655d5cd5b6d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { + if (file.SourceURI.Value == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + if (file.SourceURI.IsSet) writer.WriteString("sourceURI", file.SourceURI.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index e4c63fb2cbc6..97249c594263 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -178,6 +178,12 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { + if (fileSchemaTestClass.File.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.Files.Value == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + if (fileSchemaTestClass.File.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index 318b62f5da62..b4f1a36c4f8c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { + if (foo.Bar.Value == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + if (foo.Bar.IsSet) writer.WriteString("bar", foo.Bar.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index e2e0d7cd52d7..4dc68e62b6e4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { + if (fooGetDefaultResponse.VarString.Value == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + if (fooGetDefaultResponse.VarString.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index f0626b6495e7..dc5a541db248 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -512,16 +512,16 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } if (!varByte.IsSet) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); if (!date.IsSet) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); if (!number.IsSet) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); if (!password.IsSet) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); if (varByte.Value == null) throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); @@ -627,6 +627,27 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.Binary.Value == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigits.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarString.Value == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); writer.WriteString("date", formatTest.Date.ToString(DateFormat)); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index b50b03bfbf2f..0ecd4f389c9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -203,6 +203,9 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { + if (fruit.Color.Value == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + if (fruit.Color.IsSet) writer.WriteString("color", fruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index ac335a65c61b..e46437a88bc5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -202,6 +202,9 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { + if (gmFruit.Color.Value == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + if (gmFruit.Color.IsSet) writer.WriteString("color", gmFruit.Color.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index df79594c7836..7f03cc930b02 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -138,7 +138,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); @@ -172,6 +172,9 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 05d6dc00c0b2..9a734ddca781 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -213,6 +213,12 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { + if (hasOnlyReadOnly.Bar.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.Foo.Value == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + if (hasOnlyReadOnly.Bar.IsSet) writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index bfb2e51e08d0..b121190352ca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -134,10 +134,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); @@ -175,6 +175,12 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index cf07e34fb205..aaace3024a91 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { + if (list.Var123List.Value == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + if (list.Var123List.IsSet) writer.WriteString("123-list", list.Var123List.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 41d23030588a..467e0d15e310 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -176,6 +176,12 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { + if (literalStringClass.EscapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + if (literalStringClass.EscapedLiteralString.IsSet) writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs index 6d861cf51efc..4b47f18e5ac7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -217,7 +217,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); @@ -275,6 +275,9 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index c6fdd5671ee6..6a9e14232f95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -280,6 +280,18 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { + if (mapTest.DirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMap.Value == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + if (mapTest.DirectMap.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index bd0f20d5fc16..5f111bb44429 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -225,6 +225,9 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { + if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 8c3506247137..6f115400c61a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { + if (model200Response.VarClass.Value == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + if (model200Response.VarClass.IsSet) writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index 352915a9b5ee..e8a6cc98c5cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { + if (modelClient.VarClient.Value == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + if (modelClient.VarClient.IsSet) writer.WriteString("client", modelClient.VarClient.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index 25e952643413..b0a05aa476ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -207,7 +207,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!varName.IsSet) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + throw new ArgumentException("Property is required for class Name.", nameof(varName)); if (varName.Value == null) throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); @@ -253,6 +253,9 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { + if (name.Property.Value == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) writer.WriteString("property", name.Property.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 566cd90fa667..867c76a641df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -143,10 +143,10 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } if (!aObjVariableobject.IsSet) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); if (!pkiNotificationtestID.IsSet) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); if (aObjVariableobject.Value == null) throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); @@ -184,6 +184,9 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 82dd5aa886b6..71b9e38b1348 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -338,6 +338,12 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { + if (nullableClass.ArrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + if (nullableClass.ArrayItemsNullable.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs index 67194a079381..b9a9262817dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -194,7 +194,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index fb0980df5aa3..5e6872c85ad4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -216,6 +216,15 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { + if (objectWithDeprecatedFields.Bars.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRef.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.Uuid.Value == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (objectWithDeprecatedFields.Bars.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 6c3f344b967d..9eb3c490bfc2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -195,6 +195,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { + if (outerComposite.MyString.Value == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + if (outerComposite.MyBoolean.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs index 52a9b17f7c39..eed898ba2b31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -104,7 +104,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } if (!petType.IsSet) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); if (petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); @@ -138,6 +138,9 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 0dcd9935f9ca..41b0a8cff019 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -282,10 +282,10 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!name.IsSet) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(name)); if (!photoUrls.IsSet) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); if (name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); @@ -339,6 +339,18 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.Category.Value == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); + + if (pet.Tags.Value == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs index fcc56f4a1389..25983ae01515 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs @@ -194,7 +194,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + throw new ArgumentException("Property is required for class Pig.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index ae4d33e381d2..07e96cf8bb56 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -194,7 +194,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 664d4eb101fa..0804077cd4c8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -128,7 +128,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 299bcb68898d..d5164a7bb944 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -212,6 +212,12 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { + if (readOnlyFirst.Bar.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.Baz.Value == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + if (readOnlyFirst.Bar.IsSet) writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 4895eff3b068..e0b48de98e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -1857,70 +1857,70 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); if (!requiredNotnullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableArrayOfString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableBooleanProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); if (!requiredNullableDateProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDateProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableDatetimeProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumInteger), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumIntegerOnly), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); if (!requiredNullableEnumString.IsSet) - throw new ArgumentNullException(nameof(requiredNullableEnumString), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableIntegerProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentNullException(nameof(requiredNullableOuterEnumDefaultValue), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); if (!requiredNullableStringProp.IsSet) - throw new ArgumentNullException(nameof(requiredNullableStringProp), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); if (!requiredNullableUuid.IsSet) - throw new ArgumentNullException(nameof(requiredNullableUuid), "Property is required for class RequiredClass."); + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); if (requiredNotNullableDateProp.Value == null) throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); @@ -2049,6 +2049,18 @@ public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 3ed7cc9a1f4d..54b27bd0611e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -178,6 +178,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHash.Role.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + if (rolesReportsHash.Role.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index dea47cec965a..ef1ad83c5ac4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { + if (rolesReportsHashRole.Name.Value == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + if (rolesReportsHashRole.Name.IsSet) writer.WriteString("name", rolesReportsHashRole.Name.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 28832300fbb9..cfa91de91dce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -141,10 +141,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs index 93c0bfceac47..a65c260c9efb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs @@ -194,7 +194,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 8268d60aca90..526250148c57 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -128,7 +128,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 42c7f891e754..ccfbe3817dea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -194,7 +194,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); if (shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); @@ -244,6 +244,9 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index dc0e716e4104..1541483535d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -141,10 +141,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } if (!quadrilateralType.IsSet) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); if (!shapeType.IsSet) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); if (quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); @@ -182,6 +182,12 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 60097640238f..b29573623098 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { + if (specialModelName.VarSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + if (specialModelName.VarSpecialModelName.IsSet) writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index 47a114ecc78f..f3897baf2691 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -177,6 +177,9 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { + if (tag.Name.Value == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + if (tag.Id.IsSet) writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 8db7c285f6b0..f52b9e4a2b54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -159,6 +159,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordList.Value.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + if (testCollectionEndingWithWordList.Value.IsSet) writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 6ea936534a86..4227a82c141a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -160,6 +160,9 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 4894c12d6f39..66ff4d3f740d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -170,6 +170,9 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs index d48412119583..d3f217b6df34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -217,7 +217,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); @@ -275,6 +275,9 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index d0552a4dfeaf..728872627f36 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -128,7 +128,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } if (!triangleType.IsSet) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); if (triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); @@ -162,6 +162,9 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index 9c0be73daa82..2b736793356d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -345,6 +345,27 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { + if (user.Email.Value == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstName.Value == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastName.Value == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.Password.Value == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.Phone.Value == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.Username.Value == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.Email.IsSet) writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index 67710b37d78a..fd1678274743 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -156,7 +156,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + throw new ArgumentException("Property is required for class Whale.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); @@ -198,6 +198,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 03c924490df9..b975b1b1d987 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -234,7 +234,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } if (!className.IsSet) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); if (className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); @@ -272,6 +272,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) From d79cb9b322b19177e95b8e37d79ee84a79afd8c7 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Oct 2023 15:31:32 -0400 Subject: [PATCH 06/23] resolved conflicts --- .../ActivityOutputElementRepresentation.cs | 5 +- .../src/UseSourceGeneration/Model/Animal.cs | 3 +- .../UseSourceGeneration/Model/ApiResponse.cs | 8 +- .../src/UseSourceGeneration/Model/Apple.cs | 8 +- .../src/UseSourceGeneration/Model/AppleReq.cs | 3 +- .../UseSourceGeneration/Model/BananaReq.cs | 3 +- .../Model/Capitalization.cs | 17 +- .../src/UseSourceGeneration/Model/Cat.cs | 6 +- .../src/UseSourceGeneration/Model/Category.cs | 3 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 6 +- .../Model/ComplexQuadrilateral.cs | 3 +- .../src/UseSourceGeneration/Model/Dog.cs | 6 +- .../UseSourceGeneration/Model/EnumArrays.cs | 2 - .../src/UseSourceGeneration/Model/EnumTest.cs | 375 +---------------- .../Model/EquilateralTriangle.cs | 3 +- .../UseSourceGeneration/Model/FormatTest.cs | 45 +-- .../Model/HasOnlyReadOnly.cs | 5 +- .../Model/IsoscelesTriangle.cs | 3 +- .../Model/LiteralStringClass.cs | 5 +- .../src/UseSourceGeneration/Model/MapTest.cs | 1 - ...dPropertiesAndAdditionalPropertiesClass.cs | 10 +- .../Model/Model200Response.cs | 5 +- .../src/UseSourceGeneration/Model/Name.cs | 9 +- .../Model/NullableClass.cs | 55 ++- .../Model/ObjectWithDeprecatedFields.cs | 5 +- .../src/UseSourceGeneration/Model/Order.cs | 17 +- .../Model/OuterComposite.cs | 8 +- .../src/UseSourceGeneration/Model/Pet.cs | 9 +- .../Model/ReadOnlyFirst.cs | 5 +- .../Model/RequiredClass.cs | 177 ++++---- .../Model/ScaleneTriangle.cs | 3 +- .../Model/SimpleQuadrilateral.cs | 3 +- .../Model/SpecialModelName.cs | 5 +- .../src/UseSourceGeneration/Model/Tag.cs | 5 +- .../src/UseSourceGeneration/Model/User.cs | 28 +- .../src/UseSourceGeneration/Model/Whale.cs | 6 +- .../src/UseSourceGeneration/Model/Zebra.cs | 4 +- .../Model/ZeroBasedEnumClass.cs | 1 - .../.openapi-generator/VERSION | 2 +- .../ActivityOutputElementRepresentation.cs | 5 +- .../src/Org.OpenAPITools/Model/Animal.cs | 5 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 10 +- .../src/Org.OpenAPITools/Model/Apple.cs | 10 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 2 +- .../Org.OpenAPITools/Model/Capitalization.cs | 19 +- .../src/Org.OpenAPITools/Model/Cat.cs | 8 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 8 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 3 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 4 +- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Dog.cs | 8 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 4 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 379 +----------------- .../Model/EquilateralTriangle.cs | 3 +- .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 49 +-- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Model/GrandparentAnimal.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 7 +- .../Model/HealthCheckResult.cs | 2 +- .../Model/IsoscelesTriangle.cs | 3 +- .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 7 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 2 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 1 - ...dPropertiesAndAdditionalPropertiesClass.cs | 12 +- .../Model/Model200Response.cs | 5 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 9 +- .../Org.OpenAPITools/Model/NullableClass.cs | 55 ++- .../Model/NullableGuidClass.cs | 2 +- .../Org.OpenAPITools/Model/NullableShape.cs | 2 +- .../Model/ObjectWithDeprecatedFields.cs | 7 +- .../src/Org.OpenAPITools/Model/Order.cs | 19 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 10 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 11 +- .../src/Org.OpenAPITools/Model/Pig.cs | 2 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 2 +- .../Model/QuadrilateralInterface.cs | 2 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 7 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 191 ++++----- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 3 +- .../src/Org.OpenAPITools/Model/Shape.cs | 2 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 2 +- .../Model/SimpleQuadrilateral.cs | 3 +- .../Model/SpecialModelName.cs | 5 +- .../src/Org.OpenAPITools/Model/Tag.cs | 7 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 2 +- .../Model/TriangleInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/User.cs | 28 +- .../src/Org.OpenAPITools/Model/Whale.cs | 6 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 6 +- .../Model/ZeroBasedEnumClass.cs | 3 +- .../ActivityOutputElementRepresentation.cs | 5 +- .../src/Org.OpenAPITools/Model/Animal.cs | 3 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 8 +- .../src/Org.OpenAPITools/Model/Apple.cs | 8 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 +- .../Org.OpenAPITools/Model/Capitalization.cs | 17 +- .../src/Org.OpenAPITools/Model/Cat.cs | 6 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 6 +- .../Model/ComplexQuadrilateral.cs | 3 +- .../src/Org.OpenAPITools/Model/Dog.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 13 +- .../Model/EquilateralTriangle.cs | 3 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 45 +-- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 5 +- .../Model/IsoscelesTriangle.cs | 3 +- .../Model/LiteralStringClass.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 1 - ...dPropertiesAndAdditionalPropertiesClass.cs | 10 +- .../Model/Model200Response.cs | 5 +- .../src/Org.OpenAPITools/Model/Name.cs | 9 +- .../Org.OpenAPITools/Model/NullableClass.cs | 55 ++- .../Model/ObjectWithDeprecatedFields.cs | 5 +- .../src/Org.OpenAPITools/Model/Order.cs | 17 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 8 +- .../src/Org.OpenAPITools/Model/Pet.cs | 9 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 5 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 177 ++++---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 3 +- .../Model/SimpleQuadrilateral.cs | 3 +- .../Model/SpecialModelName.cs | 5 +- .../src/Org.OpenAPITools/Model/Tag.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 28 +- .../src/Org.OpenAPITools/Model/Whale.cs | 6 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 4 +- .../Model/ZeroBasedEnumClass.cs | 1 - .../src/Org.OpenAPITools/Model/Adult.cs | 8 +- .../src/Org.OpenAPITools/Model/Child.cs | 14 +- .../src/Org.OpenAPITools/Model/Person.cs | 8 +- .../ActivityOutputElementRepresentation.cs | 5 +- .../src/Org.OpenAPITools/Model/Animal.cs | 3 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 8 +- .../src/Org.OpenAPITools/Model/Apple.cs | 8 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 3 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 3 +- .../Org.OpenAPITools/Model/Capitalization.cs | 17 +- .../src/Org.OpenAPITools/Model/Cat.cs | 6 +- .../src/Org.OpenAPITools/Model/Category.cs | 3 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 6 +- .../Model/ComplexQuadrilateral.cs | 3 +- .../src/Org.OpenAPITools/Model/Dog.cs | 6 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 375 +---------------- .../Model/EquilateralTriangle.cs | 3 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 45 +-- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 5 +- .../Model/IsoscelesTriangle.cs | 3 +- .../Model/LiteralStringClass.cs | 5 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 1 - ...dPropertiesAndAdditionalPropertiesClass.cs | 10 +- .../Model/Model200Response.cs | 5 +- .../src/Org.OpenAPITools/Model/Name.cs | 9 +- .../Org.OpenAPITools/Model/NullableClass.cs | 55 ++- .../Model/ObjectWithDeprecatedFields.cs | 5 +- .../src/Org.OpenAPITools/Model/Order.cs | 17 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 8 +- .../src/Org.OpenAPITools/Model/Pet.cs | 9 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 5 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 177 ++++---- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 3 +- .../Model/SimpleQuadrilateral.cs | 3 +- .../Model/SpecialModelName.cs | 5 +- .../src/Org.OpenAPITools/Model/Tag.cs | 5 +- .../src/Org.OpenAPITools/Model/User.cs | 28 +- .../src/Org.OpenAPITools/Model/Whale.cs | 6 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 4 +- .../Model/ZeroBasedEnumClass.cs | 1 - 185 files changed, 839 insertions(+), 2411 deletions(-) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index ec6807f01c97..46c022562e19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -186,9 +186,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr if (activityOutputElementRepresentation.Prop2.Value == null) throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); - if (activityOutputElementRepresentation.Prop2.IsSet) + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index 38294ba531b6..e0a273d1cacb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -198,8 +198,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.Color.Value == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); - if (animal.Color.IsSet) + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index cdb36f9497a0..07455ca4be06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -203,11 +203,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, if (apiResponse.Type.Value == null) throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); - if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); - if (apiResponse.Type.IsSet) + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) writer.WriteString("type", apiResponse.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index a44bb3f38a22..fdf5ad68de22 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -232,11 +232,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ if (apple.Origin.Value == null) throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); - if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); - if (apple.Origin.IsSet) + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) writer.WriteString("origin", apple.Origin.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index c0fd3f5c87c7..d4d769dffb38 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -179,8 +179,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); - if (appleReq.Mealy.IsSet) + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index 956ff2d13280..b66e742c21b7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -177,8 +177,7 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - if (bananaReq.Sweet.IsSet) + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index 25836dd6b406..3faac8c216b1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -266,17 +266,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza if (capitalization.SmallSnake.Value == null) throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); - if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); - if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); - if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); - if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); - if (capitalization.SmallSnake.IsSet) + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index f67a17e7cc85..99943e2df5d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -174,10 +174,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.Color.Value == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); - if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); - if (cat.Color.IsSet) + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) writer.WriteString("color", cat.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 8325b95ecea8..97ba57b23949 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -186,8 +186,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.Id.IsSet) + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index 9004cedd6356..2bf8c1a95d4f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -93,7 +93,6 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -221,9 +220,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe if (childCat.Name.Value == null) throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index fb98b56bbcaa..c29c8456bf96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -191,8 +191,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index 25acadd86861..37ac175257b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -176,10 +176,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.Color.Value == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); - if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); - if (dog.Color.IsSet) + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) writer.WriteString("color", dog.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index eefdf116cb23..7477523d599c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -104,7 +104,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -171,7 +170,6 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index bcb92f9bad7a..9ff7fdbab6ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -62,369 +62,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option -<<<<<<< HEAD -======= - /// Defines EnumInteger - /// - public enum EnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerEnum EnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumInteger - /// - [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } - - /// - /// Defines EnumIntegerOnly - /// - public enum EnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumIntegerOnly - /// - [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } - - /// - /// Defines EnumNumber - /// - public enum EnumNumberEnum - { - /// - /// Enum NUMBER_1_DOT_1 for value: 1.1 - /// - NUMBER_1_DOT_1 = 1, - - /// - /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 - /// - NUMBER_MINUS_1_DOT_2 = 2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumNumberEnum EnumNumberEnumFromString(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) - { - - if (value == EnumNumberEnum.NUMBER_1_DOT_1) - return 1.1; - - if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) - return -1.2; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumNumber - /// - [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } - - /// - /// Defines EnumString - /// - public enum EnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringEnum EnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) - { - - if (value == EnumStringEnum.UPPER) - return "UPPER"; - - if (value == EnumStringEnum.Lower) - return "lower"; - - if (value == EnumStringEnum.Empty) - return ""; - - if (value == EnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumString - /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } - - /// ->>>>>>> master /// Defines EnumStringRequired /// public enum EnumStringRequiredEnum @@ -547,7 +184,6 @@ public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string val /// public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) { - if (value == EnumStringRequiredEnum.UPPER) return "UPPER"; @@ -1166,13 +802,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); - if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); - if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index b3c72164347c..e99f60cdbe60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -191,8 +191,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index 35afd27c15d6..cc6e5395a381 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -653,40 +653,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - if (formatTest.Binary.IsSet) + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimal.IsSet) + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); - if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); - if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); - if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); - if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); - if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); - if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); - if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); - if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); - if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); - if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); - if (formatTest.Uuid.IsSet) + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) writer.WriteString("uuid", formatTest.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index 699915c73c48..bc168e8d134b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -222,9 +222,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe if (hasOnlyReadOnly.Foo.Value == null) throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); - if (hasOnlyReadOnly.Foo.IsSet) + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index 5481cb516fc1..cf075d50b529 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -184,8 +184,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 3937265a2702..7255eff69394 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -185,9 +185,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera if (literalStringClass.UnescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); - if (literalStringClass.UnescapedLiteralString.IsSet) + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index 661a275b2748..9fbce04435cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -108,7 +108,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index bc990df72bca..f12e4cccbdcf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -231,14 +231,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); - if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index f71039869f10..e6b2327c8929 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -183,9 +183,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 if (model200Response.VarClass.Value == null) throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); - if (model200Response.Name.IsSet) + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 86f6910e9b31..3751a4a7b237 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -259,12 +259,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.Property.Value == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); - if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); - if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); - if (name.Var123Number.IsSet) + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) writer.WriteNumber("123Number", name.Var123Number.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index b1915bcaf6ea..06ddb2cdcb1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -369,32 +369,27 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); - if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); - if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) if (nullableClass.ObjectAndItemsNullableProp.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -410,10 +405,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index 1ff0c3b59aa4..16ad6a31adf9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -234,9 +234,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.DeprecatedRef.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); - if (objectWithDeprecatedFields.Uuid.IsSet) + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index af0600e8c728..575f70b206a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -124,7 +124,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Placed) return "placed"; @@ -343,21 +342,17 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); - if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); - if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); - if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) + if (order.Complete.IsSet) writer.WriteBoolean("complete", order.Complete.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index b92e3e3fb7c7..ea68b4888fe6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -201,11 +201,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo if (outerComposite.MyString.Value == null) throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); - if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); - if (outerComposite.MyString.IsSet) + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) writer.WriteString("my_string", outerComposite.MyString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index ba6e4bee64c5..7afd4963ae5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -124,7 +124,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Available) return "available"; @@ -355,15 +354,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Tags.Value == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.Category.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index 53e4b097b424..266640a22223 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -221,9 +221,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir if (readOnlyFirst.Baz.Value == null) throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); - if (readOnlyFirst.Baz.IsSet) + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) writer.WriteString("baz", readOnlyFirst.Baz.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs index 2d6e5bc50135..170c76292283 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -2064,14 +2064,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringProp.Value == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); - writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else @@ -2080,25 +2075,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); - if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); - if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); - if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); - if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else @@ -2109,48 +2095,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); - if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); - if (requiredClass.RequiredNullableArrayOfString != null) + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); } else writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); - if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); - if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); - if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); - if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { @@ -2161,25 +2139,21 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("required_nullable_outerEnumDefaultValue"); } - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); - if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); - if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); - if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) if (requiredClass.NotrequiredNullableArrayOfString.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2187,27 +2161,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); - if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); - if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); - if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else @@ -2221,15 +2191,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); - if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else writer.WriteNull("notrequired_nullable_uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index dc7b4c54175f..f5b18a700216 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -191,8 +191,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index 92661400a19f..aaef1c1d88a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -191,8 +191,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 27384e659ef4..4f1c8f6e0745 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -183,9 +183,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM if (specialModelName.VarSpecialModelName.Value == null) throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); - if (specialModelName.SpecialPropertyName.IsSet) + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index 834d33968324..b290f8a6a7bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -183,9 +183,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp if (tag.Name.Value == null) throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); - if (tag.Name.IsSet) + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) writer.WriteString("name", tag.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index be451156141e..9411a42098bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -369,26 +369,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.Username.Value == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); - if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); - if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); - if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); - if (user.ObjectWithNoDeclaredProps.IsSet) + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); - if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); - if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); - if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); - if (user.AnyTypeProp.IsSet) + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index 7dc8e1d34af5..8f91b1a1b048 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -204,10 +204,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); - if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); - if (whale.HasTeeth.IsSet) + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 181dfa7e2f81..89deaa9b2d22 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -115,7 +115,6 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { - if (value == TypeEnum.Plains) return "plains"; @@ -279,8 +278,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index 7fd6f526bfea..44b71de59c32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -102,7 +102,6 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index a51e15fc5399..ab80d4741ddf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -185,9 +185,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr if (activityOutputElementRepresentation.Prop2.Value == null) throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); - if (activityOutputElementRepresentation.Prop2.IsSet) + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value);// 1 if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 1469424d45ad..a85e9366c43f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -197,9 +197,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.Color.Value == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); - if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value); + writer.WriteString("className", animal.ClassName);// 1 if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index c25d4c6a0d95..9f4912d3b9ef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -202,12 +202,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, if (apiResponse.Type.Value == null) throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); - if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); - if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value); + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value);// 1 if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index f7660b3d0c60..588420022f76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -231,12 +231,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ if (apple.Origin.Value == null) throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); - if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); - if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value); + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value);// 1 if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value);// 1 if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 4213752d722a..727dad47b1c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -178,8 +178,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); - if (appleReq.Mealy.IsSet) + writer.WriteString("cultivar", appleReq.Cultivar);// 1 if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index f83e34586321..46f6f565bb68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -176,8 +176,7 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - if (bananaReq.Sweet.IsSet) + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 5ec466600efb..92a8a31c7d15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); + writer.WriteString("className", basquePig.ClassName);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 24a33a3e99b5..572aa5bf9421 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -265,18 +265,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza if (capitalization.SmallSnake.Value == null) throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); - if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); - if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); - if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); - if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); - if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value); + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value);// 1 if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value);// 1 if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value);// 1 if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value);// 1 if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value);// 1 if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 5842f853a956..16a34f36319d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -173,11 +173,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.Color.Value == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); - if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); - if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value); + writer.WriteString("className", cat.ClassName);// 1 if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) + writer.WriteString("color", cat.Color.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 94bee4a895d1..47673859e8e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -185,8 +185,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.Id.IsSet) + writer.WriteString("name", category.Name);// 1 if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index c234856c562e..fc561c8c1fcf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -92,7 +92,6 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -220,11 +219,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe if (childCat.Name.Value == null) throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value);// 1 var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) - writer.WriteString("pet_type", petTypeRawValue); + writer.WriteString("pet_type", petTypeRawValue); // 4 else writer.WriteNull("pet_type"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 9ed3c6423d1c..4bf361f2966a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value); + writer.WriteString("_class", classModel.VarClass.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 32690611673e..ee5195e14903 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -190,8 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType);// 1 writer.WriteString("shapeType", complexQuadrilateral.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index 8699f7daf334..f80f9c0a5ad7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); + writer.WriteString("className", danishPig.ClassName);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index a80063846632..85da3086da7c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -47,7 +47,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] public Option DateOnlyProperty { get; set; } @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat));// 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 19468560680b..4d16846b10f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value); + writer.WriteString("name", deprecatedObject.Name.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 68701d408fd8..d7634436fd31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -175,11 +175,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.Color.Value == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); - if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); - if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value); + writer.WriteString("className", dog.ClassName);// 1 if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value);// 1 if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index cb4dea41f889..f2450d690390 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -103,7 +103,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -170,7 +169,6 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -323,7 +321,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) - writer.WriteString("just_symbol", justSymbolRawValue); + writer.WriteString("just_symbol", justSymbolRawValue); // 4 else writer.WriteNull("just_symbol"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 89c099a75f4f..2b27d34716d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -61,369 +61,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option -<<<<<<< HEAD -======= - /// Defines EnumInteger - /// - public enum EnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerEnum EnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumInteger - /// - [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } - - /// - /// Defines EnumIntegerOnly - /// - public enum EnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumIntegerOnly - /// - [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } - - /// - /// Defines EnumNumber - /// - public enum EnumNumberEnum - { - /// - /// Enum NUMBER_1_DOT_1 for value: 1.1 - /// - NUMBER_1_DOT_1 = 1, - - /// - /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 - /// - NUMBER_MINUS_1_DOT_2 = 2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumNumberEnum EnumNumberEnumFromString(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) - { - - if (value == EnumNumberEnum.NUMBER_1_DOT_1) - return 1.1; - - if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) - return -1.2; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumNumber - /// - [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } - - /// - /// Defines EnumString - /// - public enum EnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringEnum EnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) - { - - if (value == EnumStringEnum.UPPER) - return "UPPER"; - - if (value == EnumStringEnum.Lower) - return "lower"; - - if (value == EnumStringEnum.Empty) - return ""; - - if (value == EnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumString - /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } - - /// ->>>>>>> master /// Defines EnumStringRequired /// public enum EnumStringRequiredEnum @@ -546,7 +183,6 @@ public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string val /// public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) { - if (value == EnumStringRequiredEnum.UPPER) return "UPPER"; @@ -1161,19 +797,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe { var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) - writer.WriteString("enum_string_required", enumStringRequiredRawValue); + writer.WriteString("enum_string_required", enumStringRequiredRawValue); // 4 else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); - if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); - if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); + writer.WriteString("enum_string", enumStringRawValue); // 4 else writer.WriteNull("enum_string"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 15c3eab96ef2..fc0da0406245 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -190,8 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType);// 1 writer.WriteString("triangleType", equilateralTriangle.TriangleType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index cb6214ed3f0a..09264b0df16e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value); + writer.WriteString("sourceURI", file.SourceURI.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index 59eb60db9853..d50e82b92401 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value); + writer.WriteString("bar", foo.Bar.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 7ecea7969f81..7b2f357244d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -89,7 +89,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } @@ -652,41 +652,26 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - if (formatTest.Binary.IsSet) + writer.WriteString("date", formatTest.Date.ToString(DateFormat));// 2 writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password);// 1 if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimal.IsSet) + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat));// 3 if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); - if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); - if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); - if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); - if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); - if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); - if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); - if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); - if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); - if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); - if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); - if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value);// 1 if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value);// 1 if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value);// 1 if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value);// 1 if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) + writer.WriteString("uuid", formatTest.Uuid.Value); // 7 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 9f734a97b691..53971d133fbb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -209,7 +209,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 600018e5f77f..46dc0c668cd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -208,7 +208,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value); + writer.WriteString("color", gmFruit.Color.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 5c2b20cd6e73..0df53453e343 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -177,7 +177,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); + writer.WriteString("pet_type", grandparentAnimal.PetType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index e692dc60b47f..7a9dbfb538fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -221,10 +221,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe if (hasOnlyReadOnly.Foo.Value == null) throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); - if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value);// 1 if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 01dce6e04e4a..b4a187882d26 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -158,7 +158,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessage.IsSet) if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value);// 1 else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 7fd8fa409bc5..9c452de1e01d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -183,8 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType);// 1 writer.WriteString("triangleType", isoscelesTriangle.TriangleType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index 7d80e50a7245..e70622179d9a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value); + writer.WriteString("123-list", list.Var123List.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8d5a67d38e70..72b2aa62ef15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -184,10 +184,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera if (literalStringClass.UnescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); - if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value);// 1 if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index e861f1c1432c..a3e4cb59a9ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -280,7 +280,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); + writer.WriteString("className", mammal.ClassName);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index 815d1e7122db..41a63a364d45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -107,7 +107,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 19476345ce3b..c22cd9a91a64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -230,15 +230,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat));// 3 if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); - if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); // 7 if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); // 7 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index ec015ad08c1e..019118889712 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -182,9 +182,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 if (model200Response.VarClass.Value == null) throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); - if (model200Response.Name.IsSet) + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value);// 1 if (model200Response.Name.IsSet) writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 5fcd1fcca67d..b7ac2e7579dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value); + writer.WriteString("client", modelClient.VarClient.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index d8960c3986e0..060644c18042 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -258,12 +258,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.Property.Value == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); - if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); - if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); - if (name.Var123Number.IsSet) + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value);// 1 if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) writer.WriteNumber("123Number", name.Var123Number.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 845ab19c2d86..58d64d9f81e2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -368,32 +368,27 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); - if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); - if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat));// 2 + else + writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat));// 3 + else + writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) if (nullableClass.ObjectAndItemsNullableProp.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -409,10 +404,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value);// 1 + else writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 766d377df021..8db5bd0a1cca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -160,7 +160,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.Uuid.IsSet) if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); // 7 else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index 02a1e7ed5502..7114843d8df8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); + writer.WriteString("shapeType", nullableShape.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index f412d58b602e..3f053052dd40 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -233,10 +233,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.DeprecatedRef.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); - if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 5059949b8432..22da3887608d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -123,7 +123,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Placed) return "placed"; @@ -342,21 +341,17 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); - if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); - if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); - if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat));// 3 var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) - writer.WriteString("status", statusRawValue); + writer.WriteString("status", statusRawValue); // 4 else writer.WriteNull("status"); - if (order.Complete.IsSet) + if (order.Complete.IsSet) writer.WriteBoolean("complete", order.Complete.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 27cf28b6f740..9d79ea807a95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -200,12 +200,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo if (outerComposite.MyString.Value == null) throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); - if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); - if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value); + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) + writer.WriteString("my_string", outerComposite.MyString.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 9ae0e661c71f..06a17c32752b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -143,7 +143,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); + writer.WriteString("pet_type", parentPet.PetType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 5e020cdf180b..2bd7b0a6f35e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -123,7 +123,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Available) return "available"; @@ -354,17 +353,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Tags.Value == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name);// 1 writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.Category.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) - writer.WriteString("status", statusRawValue); + writer.WriteString("status", statusRawValue); // 4 else writer.WriteNull("status"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index e88caaa7862d..ed4e019d8c68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); + writer.WriteString("className", pig.ClassName);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 933da7c6dce7..de52f760a548 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index b9bfac847eb2..313d0ee36af3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index feb6a6defa21..e32eae4b4d1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -220,10 +220,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir if (readOnlyFirst.Baz.Value == null) throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); - if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value); + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value);// 1 if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index 838666fac69d..d85c23a506aa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2063,43 +2063,29 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringProp.Value == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); - writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat));// 2 writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat));// 3 writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); // 4 else writer.WriteNull("required_notnullable_enum_string"); var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); - if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); - if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); // 6 + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp);// 1 writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 7 writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat));// 2 if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); - if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); - if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat));// 3 if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); // 4 else writer.WriteNull("notrequired_notnullable_enum_string"); @@ -2108,77 +2094,65 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); - if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); - if (requiredClass.RequiredNullableArrayOfString != null) + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value);// 1 if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); // 7 if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); } else writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); - if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); - if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); - if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); - if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat));// 2 + else + writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat));// 3 + else + writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); // 4 else writer.WriteNull("required_nullable_enum_string"); - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); // 5 else writer.WriteNull("required_nullable_outerEnumDefaultValue"); } - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); - if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); - if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); - if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp);// 1 + else + writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 7 + else + writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat));// 2 + else + writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) if (requiredClass.NotrequiredNullableArrayOfString.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2186,29 +2160,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); - if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); - if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); - if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat));// 3 + else + writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); // 4 else writer.WriteNull("notrequired_nullable_enum_string"); @@ -2220,15 +2190,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); - if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value);// 1 + else + writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); // 7 + else writer.WriteNull("notrequired_nullable_uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index c50af5ccb341..63ccec105d1b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -187,7 +187,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); // 7 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3b9e8d5d172c..18e4b7f0d852 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value); + writer.WriteString("name", rolesReportsHashRole.Name.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index aba9e8e50bbf..5b3568eb57f0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -190,8 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType);// 1 writer.WriteString("triangleType", scaleneTriangle.TriangleType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index e4d6646dc4c9..f5f147226084 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); + writer.WriteString("shapeType", shape.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 9a9d2701e0bc..38ff06486027 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); + writer.WriteString("shapeType", shapeInterface.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 5b3dd56409eb..abce57775b73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); + writer.WriteString("shapeType", shapeOrNull.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 759916fc89bd..d1365616d663 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -190,8 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType);// 1 writer.WriteString("shapeType", simpleQuadrilateral.ShapeType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 61a55b082147..07aa6bf18e5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -182,9 +182,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM if (specialModelName.VarSpecialModelName.Value == null) throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); - if (specialModelName.SpecialPropertyName.IsSet) + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value);// 1 if (specialModelName.SpecialPropertyName.IsSet) writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index 5225b599634b..aa655109a750 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -182,10 +182,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp if (tag.Name.Value == null) throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); - if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value); + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) + writer.WriteString("name", tag.Name.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index da2ce0a17c4b..9df0799fbe57 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 237a67c659d7..6b0cad22de6b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -176,7 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 7bfd7ebaa77f..6f5af0fb4c59 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -280,7 +280,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); + writer.WriteString("triangleType", triangle.TriangleType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index 2813cefdcfbb..dbdba2604450 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); + writer.WriteString("triangleType", triangleInterface.TriangleType);// 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 575099e5cb81..f101f51033d5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -368,26 +368,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.Username.Value == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); - if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); - if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); - if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); - if (user.ObjectWithNoDeclaredProps.IsSet) + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value);// 1 if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value);// 1 if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value);// 1 if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); - if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); - if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); - if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); - if (user.AnyTypeProp.IsSet) + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value);// 1 if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value);// 1 if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value);// 1 if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 1430d60b5606..119231862b34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -203,10 +203,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); - if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); - if (whale.HasTeeth.IsSet) + writer.WriteString("className", whale.ClassName);// 1 if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index c6f47ec7bf19..359fcb6ddeaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -114,7 +114,6 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { - if (value == TypeEnum.Plains) return "plains"; @@ -278,10 +277,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + writer.WriteString("className", zebra.ClassName);// 1 var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) - writer.WriteString("type", typeRawValue); + writer.WriteString("type", typeRawValue); // 4 else writer.WriteNull("type"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 2ebfbd4a2386..7ffb1675c0c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -101,7 +101,6 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -232,7 +231,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBa { var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) - writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); // 4 else writer.WriteNull("ZeroBasedEnum"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index e471b77cdb4b..9927e551973e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -183,9 +183,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr if (activityOutputElementRepresentation.Prop2.Value == null) throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); - if (activityOutputElementRepresentation.Prop2.IsSet) + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index b7fd25d28f73..9d3a5c581ac7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -195,8 +195,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.Color.Value == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); - if (animal.Color.IsSet) + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 84f0343f54b8..a9c88ec75107 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -200,11 +200,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, if (apiResponse.Type.Value == null) throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); - if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); - if (apiResponse.Type.IsSet) + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) writer.WriteString("type", apiResponse.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index ca0904429525..fde2a2e345fd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -229,11 +229,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ if (apple.Origin.Value == null) throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); - if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); - if (apple.Origin.IsSet) + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) writer.WriteString("origin", apple.Origin.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index 73382613db6d..18fc7f3f3216 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -176,8 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); - if (appleReq.Mealy.IsSet) + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 9053162dbb5e..33deb0eeffd9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -174,8 +174,7 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - if (bananaReq.Sweet.IsSet) + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index d2fb048e6a06..b7384c4a5b19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -263,17 +263,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza if (capitalization.SmallSnake.Value == null) throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); - if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); - if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); - if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); - if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); - if (capitalization.SmallSnake.IsSet) + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 2e71acf4de5e..b5818597320e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -171,10 +171,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.Color.Value == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); - if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); - if (cat.Color.IsSet) + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) writer.WriteString("color", cat.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 1db576266dd2..4354c0ae89cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -183,8 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.Id.IsSet) + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 581ac0a11076..36e500ad991f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -90,7 +90,6 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -218,9 +217,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe if (childCat.Name.Value == null) throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 1e2523ee03cf..4565776de706 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index feee96455e28..5bf025cfe1be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -173,10 +173,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.Color.Value == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); - if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); - if (dog.Color.IsSet) + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) writer.WriteString("color", dog.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 62609606fe85..e89d8ebabcec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -101,7 +101,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -168,7 +167,6 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 1f03f62aa236..1e7c2e182a77 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -181,7 +181,6 @@ public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string val /// public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) { - if (value == EnumStringRequiredEnum.UPPER) return "UPPER"; @@ -801,15 +800,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe writer.WriteNull("enum_string_required"); if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); - - if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); - - if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 301beabda96e..7af10613ef2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index dc5a541db248..d60727736d3a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -650,40 +650,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - if (formatTest.Binary.IsSet) + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimal.IsSet) + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); - if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); - if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); - if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); - if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); - if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); - if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); - if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); - if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); - if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); - if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); - if (formatTest.Uuid.IsSet) + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) writer.WriteString("uuid", formatTest.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 9a734ddca781..754c25d5eea7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -219,9 +219,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe if (hasOnlyReadOnly.Foo.Value == null) throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); - if (hasOnlyReadOnly.Foo.IsSet) + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index b121190352ca..e23d0ddf0c0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -181,8 +181,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 467e0d15e310..c133271c04c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -182,9 +182,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera if (literalStringClass.UnescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); - if (literalStringClass.UnescapedLiteralString.IsSet) + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index 8b11318c1822..6a9e14232f95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -105,7 +105,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5f111bb44429..eebbb305b63d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -228,14 +228,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); - if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 6f115400c61a..65f28e93b433 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 if (model200Response.VarClass.Value == null) throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); - if (model200Response.Name.IsSet) + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index b0a05aa476ea..fed1dea8b9fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -256,12 +256,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.Property.Value == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); - if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); - if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); - if (name.Var123Number.IsSet) + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) writer.WriteNumber("123Number", name.Var123Number.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 71b9e38b1348..12a42a0308fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -366,32 +366,27 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); - if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); - if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) if (nullableClass.ObjectAndItemsNullableProp.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -407,10 +402,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 5e6872c85ad4..01afc19a7190 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -231,9 +231,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.DeprecatedRef.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); - if (objectWithDeprecatedFields.Uuid.IsSet) + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index faefe3179e10..68bd7eae6f50 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -121,7 +121,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Placed) return "placed"; @@ -340,21 +339,17 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); - if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); - if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); - if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) + if (order.Complete.IsSet) writer.WriteBoolean("complete", order.Complete.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 9eb3c490bfc2..94decb7debbd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -198,11 +198,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo if (outerComposite.MyString.Value == null) throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); - if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); - if (outerComposite.MyString.IsSet) + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) writer.WriteString("my_string", outerComposite.MyString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 43b5170adeb3..226f77e03009 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -121,7 +121,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Available) return "available"; @@ -352,15 +351,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Tags.Value == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.Category.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index d5164a7bb944..5acfdc25b589 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -218,9 +218,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir if (readOnlyFirst.Baz.Value == null) throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); - if (readOnlyFirst.Baz.IsSet) + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) writer.WriteString("baz", readOnlyFirst.Baz.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index e0b48de98e12..6ae20bbe399f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2061,14 +2061,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringProp.Value == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); - writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else @@ -2077,25 +2072,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); - if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); - if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); - if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); - if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else @@ -2106,48 +2092,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); - if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); - if (requiredClass.RequiredNullableArrayOfString != null) + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); } else writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); - if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); - if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); - if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); - if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { @@ -2158,25 +2136,21 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("required_nullable_outerEnumDefaultValue"); } - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); - if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); - if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); - if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) if (requiredClass.NotrequiredNullableArrayOfString.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2184,27 +2158,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); - if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); - if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); - if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else @@ -2218,15 +2188,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); - if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else writer.WriteNull("notrequired_nullable_uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index cfa91de91dce..2252bd8cb94f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 1541483535d1..29a0757f6a6c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index b29573623098..ff962f637f2d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM if (specialModelName.VarSpecialModelName.Value == null) throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); - if (specialModelName.SpecialPropertyName.IsSet) + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index f3897baf2691..226c6f1e6fdf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp if (tag.Name.Value == null) throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); - if (tag.Name.IsSet) + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) writer.WriteString("name", tag.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index 2b736793356d..a274f3d6e631 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -366,26 +366,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.Username.Value == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); - if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); - if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); - if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); - if (user.ObjectWithNoDeclaredProps.IsSet) + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); - if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); - if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); - if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); - if (user.AnyTypeProp.IsSet) + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index fd1678274743..37036ab1f126 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -201,10 +201,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); - if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); - if (whale.HasTeeth.IsSet) + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 2e494a4db6ae..9099a6a39579 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -112,7 +112,6 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { - if (value == TypeEnum.Plains) return "plains"; @@ -276,8 +275,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 08d723ade03b..042dcb1ca2ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -99,7 +99,6 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index cb21d8fbac2e..e55d68956190 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -188,11 +188,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializ if (adult.Children.IsSet) writer.WritePropertyName("children"); JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); - if (adult.FirstName.IsSet) - writer.WriteString("firstName", adult.FirstName.Value); - if (adult.LastName.IsSet) - writer.WriteString("lastName", adult.LastName.Value); - if (adult.Type.IsSet) + if (adult.FirstName.IsSet) + writer.WriteString("firstName", adult.FirstName.Value); if (adult.LastName.IsSet) + writer.WriteString("lastName", adult.LastName.Value); if (adult.Type.IsSet) writer.WriteString("$_type", adult.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index 2b0f5675b0e0..e7e6fd04c710 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -200,15 +200,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializ if (child.Type.Value == null) throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child."); - if (child.Age.IsSet) - writer.WriteNumber("age", child.Age.Value); - if (child.FirstName.IsSet) - writer.WriteString("firstName", child.FirstName.Value); - if (child.LastName.IsSet) - writer.WriteString("lastName", child.LastName.Value); - if (child.Type.IsSet) - writer.WriteString("$_type", child.Type.Value); - if (child.BoosterSeat.IsSet) + if (child.Age.IsSet) + writer.WriteNumber("age", child.Age.Value); if (child.FirstName.IsSet) + writer.WriteString("firstName", child.FirstName.Value); if (child.LastName.IsSet) + writer.WriteString("lastName", child.LastName.Value); if (child.Type.IsSet) + writer.WriteString("$_type", child.Type.Value); if (child.BoosterSeat.IsSet) writer.WriteBoolean("boosterSeat", child.BoosterSeat.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index 7054da1d52ff..0d372a97b170 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -214,11 +214,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerial if (person.Type.Value == null) throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person."); - if (person.FirstName.IsSet) - writer.WriteString("firstName", person.FirstName.Value); - if (person.LastName.IsSet) - writer.WriteString("lastName", person.LastName.Value); - if (person.Type.IsSet) + if (person.FirstName.IsSet) + writer.WriteString("firstName", person.FirstName.Value); if (person.LastName.IsSet) + writer.WriteString("lastName", person.LastName.Value); if (person.Type.IsSet) writer.WriteString("$_type", person.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index e471b77cdb4b..9927e551973e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -183,9 +183,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr if (activityOutputElementRepresentation.Prop2.Value == null) throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); - if (activityOutputElementRepresentation.Prop2.IsSet) + if (activityOutputElementRepresentation.Prop1.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index b7fd25d28f73..9d3a5c581ac7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -195,8 +195,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.Color.Value == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); - if (animal.Color.IsSet) + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) writer.WriteString("color", animal.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 84f0343f54b8..a9c88ec75107 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -200,11 +200,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, if (apiResponse.Type.Value == null) throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); - if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); - if (apiResponse.Type.IsSet) + if (apiResponse.Code.IsSet) + writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) + writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) writer.WriteString("type", apiResponse.Type.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index ca0904429525..fde2a2e345fd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -229,11 +229,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ if (apple.Origin.Value == null) throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); - if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); - if (apple.Origin.IsSet) + if (apple.ColorCode.IsSet) + writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) writer.WriteString("origin", apple.Origin.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index 73382613db6d..18fc7f3f3216 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -176,8 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); - if (appleReq.Mealy.IsSet) + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index 9053162dbb5e..33deb0eeffd9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -174,8 +174,7 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - if (bananaReq.Sweet.IsSet) + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) writer.WriteBoolean("sweet", bananaReq.Sweet.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index d2fb048e6a06..b7384c4a5b19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -263,17 +263,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza if (capitalization.SmallSnake.Value == null) throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); - if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); - if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); - if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); - if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); - if (capitalization.SmallSnake.IsSet) + if (capitalization.ATT_NAME.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 2e71acf4de5e..b5818597320e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -171,10 +171,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.Color.Value == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); - if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); - if (cat.Color.IsSet) + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) + writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) writer.WriteString("color", cat.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 1db576266dd2..4354c0ae89cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -183,8 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.Id.IsSet) + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index 581ac0a11076..36e500ad991f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -90,7 +90,6 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -218,9 +217,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe if (childCat.Name.Value == null) throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + if (childCat.Name.IsSet) + writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 1e2523ee03cf..4565776de706 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index feee96455e28..5bf025cfe1be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -173,10 +173,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.Color.Value == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); - if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); - if (dog.Color.IsSet) + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) writer.WriteString("color", dog.Color.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 62609606fe85..e89d8ebabcec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -101,7 +101,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -168,7 +167,6 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index d3efd95fe1b8..1e7c2e182a77 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -59,369 +59,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option -<<<<<<< HEAD -======= - /// Defines EnumInteger - /// - public enum EnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerEnum EnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerEnum? EnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return EnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return EnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumInteger - /// - [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } - - /// - /// Defines EnumIntegerOnly - /// - public enum EnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumIntegerOnlyEnum EnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type EnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumIntegerOnlyEnum? EnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return EnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets EnumIntegerOnly - /// - [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } - - /// - /// Defines EnumNumber - /// - public enum EnumNumberEnum - { - /// - /// Enum NUMBER_1_DOT_1 for value: 1.1 - /// - NUMBER_1_DOT_1 = 1, - - /// - /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 - /// - NUMBER_MINUS_1_DOT_2 = 2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumNumberEnum EnumNumberEnumFromString(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - throw new NotImplementedException($"Could not convert value to type EnumNumberEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumNumberEnum? EnumNumberEnumFromStringOrDefault(string value) - { - if (value.Equals("1.1")) - return EnumNumberEnum.NUMBER_1_DOT_1; - - if (value.Equals("-1.2")) - return EnumNumberEnum.NUMBER_MINUS_1_DOT_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) - { - - if (value == EnumNumberEnum.NUMBER_1_DOT_1) - return 1.1; - - if (value == EnumNumberEnum.NUMBER_MINUS_1_DOT_2) - return -1.2; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumNumber - /// - [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } - - /// - /// Defines EnumString - /// - public enum EnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringEnum EnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringEnum? EnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringEnum.Lower; - - if (value.Equals("")) - return EnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) - { - - if (value == EnumStringEnum.UPPER) - return "UPPER"; - - if (value == EnumStringEnum.Lower) - return "lower"; - - if (value == EnumStringEnum.Empty) - return ""; - - if (value == EnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumString - /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } - - /// ->>>>>>> master /// Defines EnumStringRequired /// public enum EnumStringRequiredEnum @@ -544,7 +181,6 @@ public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string val /// public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) { - if (value == EnumStringRequiredEnum.UPPER) return "UPPER"; @@ -1163,13 +799,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); - if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); - if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); + if (enumTest.EnumInteger.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 301beabda96e..7af10613ef2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index dc5a541db248..d60727736d3a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -650,40 +650,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - if (formatTest.Binary.IsSet) + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimal.IsSet) + if (formatTest.DateTime.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); - if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); - if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); - if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); - if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); - if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); - if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); - if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); - if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); - if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); - if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); - if (formatTest.Uuid.IsSet) + if (formatTest.VarDouble.IsSet) + writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) + writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) + writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) + writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) + writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) writer.WriteString("uuid", formatTest.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 9a734ddca781..754c25d5eea7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -219,9 +219,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe if (hasOnlyReadOnly.Foo.Value == null) throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); - if (hasOnlyReadOnly.Foo.IsSet) + if (hasOnlyReadOnly.Bar.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index b121190352ca..e23d0ddf0c0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -181,8 +181,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 467e0d15e310..c133271c04c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -182,9 +182,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera if (literalStringClass.UnescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); - if (literalStringClass.UnescapedLiteralString.IsSet) + if (literalStringClass.EscapedLiteralString.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index 8b11318c1822..6a9e14232f95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -105,7 +105,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5f111bb44429..eebbb305b63d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -228,14 +228,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); - if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 6f115400c61a..65f28e93b433 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 if (model200Response.VarClass.Value == null) throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); - if (model200Response.Name.IsSet) + if (model200Response.VarClass.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index b0a05aa476ea..fed1dea8b9fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -256,12 +256,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.Property.Value == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); - if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); - if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); - if (name.Var123Number.IsSet) + writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) + writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) + writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) writer.WriteNumber("123Number", name.Var123Number.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 71b9e38b1348..12a42a0308fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -366,32 +366,27 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); - if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); - if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullableProp.IsSet) + if (nullableClass.BooleanProp.IsSet) + if (nullableClass.BooleanProp.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); + else + writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) + if (nullableClass.DateProp.Value != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) + if (nullableClass.DatetimeProp.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) + if (nullableClass.IntegerProp.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); + else + writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) + if (nullableClass.NumberProp.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); + else + writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) if (nullableClass.ObjectAndItemsNullableProp.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -407,10 +402,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else + if (nullableClass.StringProp.IsSet) + if (nullableClass.StringProp.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp.Value); + else writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 5e6872c85ad4..01afc19a7190 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -231,9 +231,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.DeprecatedRef.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); - if (objectWithDeprecatedFields.Uuid.IsSet) + if (objectWithDeprecatedFields.Id.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index faefe3179e10..68bd7eae6f50 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -121,7 +121,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Placed) return "placed"; @@ -340,21 +339,17 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); - if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); - if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); - if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + if (order.Id.IsSet) + writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) + writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) + writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) + if (order.Complete.IsSet) writer.WriteBoolean("complete", order.Complete.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 9eb3c490bfc2..94decb7debbd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -198,11 +198,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo if (outerComposite.MyString.Value == null) throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); - if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); - if (outerComposite.MyString.IsSet) + if (outerComposite.MyBoolean.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) writer.WriteString("my_string", outerComposite.MyString.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 43b5170adeb3..226f77e03009 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -121,7 +121,6 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { - if (value == StatusEnum.Available) return "available"; @@ -352,15 +351,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Tags.Value == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.Category.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + if (pet.Id.IsSet) + writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index d5164a7bb944..5acfdc25b589 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -218,9 +218,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir if (readOnlyFirst.Baz.Value == null) throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); - if (readOnlyFirst.Baz.IsSet) + if (readOnlyFirst.Bar.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) writer.WriteString("baz", readOnlyFirst.Baz.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs index e0b48de98e12..6ae20bbe399f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2061,14 +2061,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringProp.Value == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); - writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else @@ -2077,25 +2072,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); - if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); - if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); - if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); - if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); + if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else @@ -2106,48 +2092,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); - if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); - if (requiredClass.RequiredNullableArrayOfString != null) + if (requiredClass.NotrequiredNotnullableStringProp.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); } else writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); - if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); - if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); - if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); - if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); + else + writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); + else + writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); + else + writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); + else + writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); + else + writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); + else + writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { @@ -2158,25 +2136,21 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("required_nullable_outerEnumDefaultValue"); } - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); - if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); - if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); - if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfString.IsSet) + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); + else + writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); + else + writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) + if (requiredClass.NotRequiredNullableDateProp.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); + else + writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) + if (requiredClass.NotRequiredNullableIntegerProp.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); + else + writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) if (requiredClass.NotrequiredNullableArrayOfString.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2184,27 +2158,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); - if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); - if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); - if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); + if (requiredClass.NotrequiredNullableBooleanProp.IsSet) + if (requiredClass.NotrequiredNullableBooleanProp.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); + else + writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) + if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); + else + writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) + if (requiredClass.NotrequiredNullableEnumInteger.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else @@ -2218,15 +2188,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); - if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else + if (requiredClass.NotrequiredNullableStringProp.IsSet) + if (requiredClass.NotrequiredNullableStringProp.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); + else + writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) + if (requiredClass.NotrequiredNullableUuid.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); + else writer.WriteNull("notrequired_nullable_uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index cfa91de91dce..2252bd8cb94f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 1541483535d1..29a0757f6a6c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -188,8 +188,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index b29573623098..ff962f637f2d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM if (specialModelName.VarSpecialModelName.Value == null) throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); - if (specialModelName.SpecialPropertyName.IsSet) + if (specialModelName.VarSpecialModelName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index f3897baf2691..226c6f1e6fdf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -180,9 +180,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp if (tag.Name.Value == null) throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); - if (tag.Name.IsSet) + if (tag.Id.IsSet) + writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) writer.WriteString("name", tag.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index 2b736793356d..a274f3d6e631 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -366,26 +366,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.Username.Value == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); - if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); - if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); - if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); - if (user.ObjectWithNoDeclaredProps.IsSet) + if (user.Email.IsSet) + writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) + writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) + writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); - if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); - if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); - if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); - if (user.AnyTypeProp.IsSet) + if (user.Password.IsSet) + writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) + writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) + writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index fd1678274743..37036ab1f126 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -201,10 +201,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); - if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); - if (whale.HasTeeth.IsSet) + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 2e494a4db6ae..9099a6a39579 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -112,7 +112,6 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { - if (value == TypeEnum.Plains) return "plains"; @@ -276,8 +275,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 08d723ade03b..042dcb1ca2ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -99,7 +99,6 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; From 9a65524aa8140eb1cac8da149199a5834e5bb67c Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Oct 2023 16:07:54 -0400 Subject: [PATCH 07/23] build samples --- .../.openapi-generator/VERSION | 2 +- .../ActivityOutputElementRepresentation.cs | 2 +- .../src/Org.OpenAPITools/Model/Animal.cs | 4 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 4 +- .../src/Org.OpenAPITools/Model/Apple.cs | 6 +-- .../src/Org.OpenAPITools/Model/AppleReq.cs | 2 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 2 +- .../Org.OpenAPITools/Model/Capitalization.cs | 12 +++--- .../src/Org.OpenAPITools/Model/Cat.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 2 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 4 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 2 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 4 +- .../Model/DeprecatedObject.cs | 2 +- .../src/Org.OpenAPITools/Model/Dog.cs | 6 +-- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 4 +- .../Model/EquilateralTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/File.cs | 2 +- .../src/Org.OpenAPITools/Model/Foo.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 16 +++---- .../src/Org.OpenAPITools/Model/Fruit.cs | 2 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 2 +- .../Model/GrandparentAnimal.cs | 2 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 4 +- .../Model/HealthCheckResult.cs | 2 +- .../Model/IsoscelesTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/List.cs | 2 +- .../Model/LiteralStringClass.cs | 4 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 2 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 6 +-- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 2 +- .../Org.OpenAPITools/Model/NullableClass.cs | 6 +-- .../Model/NullableGuidClass.cs | 2 +- .../Org.OpenAPITools/Model/NullableShape.cs | 2 +- .../Model/ObjectWithDeprecatedFields.cs | 2 +- .../src/Org.OpenAPITools/Model/Order.cs | 4 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 2 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 4 +- .../src/Org.OpenAPITools/Model/Pig.cs | 2 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 2 +- .../Model/QuadrilateralInterface.cs | 2 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 4 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 42 +++++++++---------- .../Model/RolesReportsHash.cs | 2 +- .../Model/RolesReportsHashRole.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/Shape.cs | 2 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 2 +- .../Model/SimpleQuadrilateral.cs | 2 +- .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../Model/TestCollectionEndingWithWordList.cs | 2 +- ...lineFreeformAdditionalPropertiesRequest.cs | 2 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 2 +- .../Model/TriangleInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/User.cs | 12 +++--- .../src/Org.OpenAPITools/Model/Whale.cs | 2 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 4 +- .../Model/ZeroBasedEnumClass.cs | 2 +- 66 files changed, 123 insertions(+), 123 deletions(-) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index ab80d4741ddf..47ab40e12266 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -186,7 +186,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value);// 1 if (activityOutputElementRepresentation.Prop2.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index a85e9366c43f..2a821b2ba116 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -197,8 +197,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.Color.Value == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName);// 1 if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value);// 1 + writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) + writer.WriteString("color", animal.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index 9f4912d3b9ef..6fb56e69d300 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -204,8 +204,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, if (apiResponse.Code.IsSet) writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value);// 1 if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value);// 1 + writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) + writer.WriteString("type", apiResponse.Type.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index 588420022f76..fc6483922321 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -232,9 +232,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value);// 1 if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value);// 1 if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value);// 1 + writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) + writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) + writer.WriteString("origin", apple.Origin.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 727dad47b1c0..56bfa0fa3603 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -178,7 +178,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar);// 1 if (appleReq.Mealy.IsSet) + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) writer.WriteBoolean("mealy", appleReq.Mealy.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 92a8a31c7d15..5ec466600efb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName);// 1 + writer.WriteString("className", basquePig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 572aa5bf9421..caf775042ee2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -266,12 +266,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value);// 1 if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value);// 1 if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value);// 1 if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value);// 1 if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value);// 1 if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value);// 1 + writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 16a34f36319d..2bd9444d3231 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -173,9 +173,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.Color.Value == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName);// 1 if (cat.Declawed.IsSet) + writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value);// 1 + writer.WriteString("color", cat.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 47673859e8e0..f63a3d7822b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -185,7 +185,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name);// 1 if (category.Id.IsSet) + writer.WriteString("name", category.Name); if (category.Id.IsSet) writer.WriteNumber("id", category.Id.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index fc561c8c1fcf..cf6b531aaf76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -220,9 +220,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value);// 1 var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); if (petTypeRawValue != null) - writer.WriteString("pet_type", petTypeRawValue); // 4 + writer.WriteString("pet_type", petTypeRawValue); else writer.WriteNull("pet_type"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 4bf361f2966a..9ed3c6423d1c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value);// 1 + writer.WriteString("_class", classModel.VarClass.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index ee5195e14903..8a22ca5f372b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -190,7 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType);// 1 writer.WriteString("shapeType", complexQuadrilateral.ShapeType);// 1 + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index f80f9c0a5ad7..8699f7daf334 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName);// 1 + writer.WriteString("className", danishPig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 85da3086da7c..a80063846632 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -47,7 +47,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] public Option DateOnlyProperty { get; set; } @@ -169,7 +169,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat));// 2 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 4d16846b10f5..19468560680b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value);// 1 + writer.WriteString("name", deprecatedObject.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index d7634436fd31..9c1c30c46a56 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -175,9 +175,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.Color.Value == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName);// 1 if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value);// 1 if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value);// 1 + writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) + writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) + writer.WriteString("color", dog.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index f2450d690390..2364179c0559 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -321,7 +321,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); if (justSymbolRawValue != null) - writer.WriteString("just_symbol", justSymbolRawValue); // 4 + writer.WriteString("just_symbol", justSymbolRawValue); else writer.WriteNull("just_symbol"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 2b27d34716d9..7d03b65dc840 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -797,7 +797,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe { var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) - writer.WriteString("enum_string_required", enumStringRequiredRawValue); // 4 + writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); @@ -806,7 +806,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); // 4 + writer.WriteString("enum_string", enumStringRawValue); else writer.WriteNull("enum_string"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index fc0da0406245..aa64d55bc195 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -190,7 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType);// 1 writer.WriteString("triangleType", equilateralTriangle.TriangleType);// 1 + writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index 09264b0df16e..cb6214ed3f0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value);// 1 + writer.WriteString("sourceURI", file.SourceURI.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index d50e82b92401..59eb60db9853 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value);// 1 + writer.WriteString("bar", foo.Bar.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 7b2f357244d6..6db9c1aac458 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -89,7 +89,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } @@ -652,11 +652,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat));// 2 writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password);// 1 if (formatTest.Binary.IsSet) + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat));// 3 if (formatTest.VarDecimal.IsSet) + writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDouble.IsSet) @@ -665,13 +665,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value);// 1 if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value);// 1 if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value);// 1 if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value);// 1 if (formatTest.UnsignedInteger.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) + writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); // 7 + writer.WriteString("uuid", formatTest.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 53971d133fbb..9f734a97b691 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -209,7 +209,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value);// 1 + writer.WriteString("color", fruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 46dc0c668cd5..600018e5f77f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -208,7 +208,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value);// 1 + writer.WriteString("color", gmFruit.Color.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 0df53453e343..5c2b20cd6e73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -177,7 +177,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType);// 1 + writer.WriteString("pet_type", grandparentAnimal.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 7a9dbfb538fe..787c486f2f99 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -222,8 +222,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value);// 1 if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value);// 1 + writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index b4a187882d26..01dce6e04e4a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -158,7 +158,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessage.IsSet) if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value);// 1 + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 9c452de1e01d..319db47dfc02 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -183,7 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType);// 1 writer.WriteString("triangleType", isoscelesTriangle.TriangleType);// 1 + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index e70622179d9a..7d80e50a7245 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value);// 1 + writer.WriteString("123-list", list.Var123List.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 72b2aa62ef15..2ede9b4c0484 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -185,8 +185,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value);// 1 if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value);// 1 + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index a3e4cb59a9ad..e861f1c1432c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -280,7 +280,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName);// 1 + writer.WriteString("className", mammal.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c22cd9a91a64..738bf4ec11d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -231,12 +231,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat));// 3 if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); // 7 if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); // 7 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index 019118889712..064b13b50785 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -183,7 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value);// 1 if (model200Response.Name.IsSet) + writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) writer.WriteNumber("name", model200Response.Name.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index b7ac2e7579dd..5fcd1fcca67d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value);// 1 + writer.WriteString("client", modelClient.VarClient.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 060644c18042..30cd71df5194 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -259,7 +259,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value);// 1 if (name.SnakeCase.IsSet) + writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) writer.WriteNumber("123Number", name.Var123Number.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 58d64d9f81e2..7d4c243525a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -374,11 +374,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla else writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat));// 2 + writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); else writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat));// 3 + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) if (nullableClass.IntegerProp.Value != null) @@ -406,7 +406,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("object_nullable_prop"); if (nullableClass.StringProp.IsSet) if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value);// 1 + writer.WriteString("string_prop", nullableClass.StringProp.Value); else writer.WriteNull("string_prop"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 8db5bd0a1cca..766d377df021 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -160,7 +160,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.Uuid.IsSet) if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); // 7 + writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index 7114843d8df8..02a1e7ed5502 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType);// 1 + writer.WriteString("shapeType", nullableShape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 3f053052dd40..0f690cdf4df3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -235,7 +235,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.Id.IsSet) writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value);// 1 + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 22da3887608d..b97c44c70dfa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -345,9 +345,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializ writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat));// 3 var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); if (statusRawValue != null) - writer.WriteString("status", statusRawValue); // 4 + writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 9d79ea807a95..d2369fb21dd6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -203,7 +203,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo if (outerComposite.MyBoolean.IsSet) writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value);// 1 + writer.WriteString("my_string", outerComposite.MyString.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 06a17c32752b..9ae0e661c71f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -143,7 +143,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType);// 1 + writer.WriteString("pet_type", parentPet.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 2bd7b0a6f35e..3be1942e830b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -353,7 +353,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Tags.Value == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name);// 1 writer.WritePropertyName("photoUrls"); + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.Category.IsSet) writer.WritePropertyName("category"); @@ -361,7 +361,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.Id.IsSet) writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); if (statusRawValue != null) - writer.WriteString("status", statusRawValue); // 4 + writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index ed4e019d8c68..e88caaa7862d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName);// 1 + writer.WriteString("className", pig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index de52f760a548..933da7c6dce7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType);// 1 + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 313d0ee36af3..b9bfac847eb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType);// 1 + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index e32eae4b4d1a..e95e4151a584 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -221,8 +221,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value);// 1 if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value);// 1 + writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index d85c23a506aa..033276d0f3bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2063,29 +2063,29 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringProp.Value == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat));// 2 writer.WritePropertyName("required_notnullable_array_of_string"); + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat));// 3 writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); // 4 + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else writer.WriteNull("required_notnullable_enum_string"); var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); // 6 + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp);// 1 writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 7 writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat));// 2 if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat));// 3 if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); // 4 + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else writer.WriteNull("notrequired_notnullable_enum_string"); @@ -2095,8 +2095,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value);// 1 if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); // 7 if (requiredClass.RequiredNullableArrayOfString != null) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2107,10 +2107,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); else writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat));// 2 + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); else writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat));// 3 + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); else writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); @@ -2120,7 +2120,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); // 4 + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); @@ -2133,20 +2133,20 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla { var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); // 5 + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); else writer.WriteNull("required_nullable_outerEnumDefaultValue"); } if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp);// 1 + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 7 + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat));// 2 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) if (requiredClass.NotRequiredNullableIntegerProp.Value != null) @@ -2166,7 +2166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat));// 3 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) if (requiredClass.NotrequiredNullableEnumInteger.Value != null) @@ -2178,7 +2178,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); // 4 + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); @@ -2192,11 +2192,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); if (requiredClass.NotrequiredNullableStringProp.IsSet) if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value);// 1 + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); else writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); // 7 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 63ccec105d1b..c50af5ccb341 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -187,7 +187,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); // 7 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 18e4b7f0d852..3b9e8d5d172c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value);// 1 + writer.WriteString("name", rolesReportsHashRole.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 5b3568eb57f0..33a3dc97be70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -190,7 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType);// 1 writer.WriteString("triangleType", scaleneTriangle.TriangleType);// 1 + writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index f5f147226084..e4d6646dc4c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType);// 1 + writer.WriteString("shapeType", shape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 38ff06486027..9a9d2701e0bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType);// 1 + writer.WriteString("shapeType", shapeInterface.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index abce57775b73..5b3dd56409eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -249,7 +249,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType);// 1 + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index d1365616d663..e423dccac8c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -190,7 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType);// 1 writer.WriteString("shapeType", simpleQuadrilateral.ShapeType);// 1 + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 07aa6bf18e5d..915b7873a681 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -183,7 +183,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value);// 1 if (specialModelName.SpecialPropertyName.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index aa655109a750..c6ba102aefe9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -184,7 +184,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp if (tag.Id.IsSet) writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value);// 1 + writer.WriteString("name", tag.Name.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 9df0799fbe57..da2ce0a17c4b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value);// 1 + writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 6b0cad22de6b..237a67c659d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -176,7 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value);// 1 + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 6f5af0fb4c59..7bfd7ebaa77f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -280,7 +280,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType);// 1 + writer.WriteString("triangleType", triangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index dbdba2604450..2813cefdcfbb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType);// 1 + writer.WriteString("triangleType", triangleInterface.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index f101f51033d5..0f0b6fe45f51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -369,17 +369,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value);// 1 if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value);// 1 if (user.Id.IsSet) + writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) + writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value);// 1 if (user.ObjectWithNoDeclaredProps.IsSet) + writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value);// 1 if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value);// 1 if (user.UserStatus.IsSet) + writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) + writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value);// 1 if (user.AnyTypeProp.IsSet) + writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) if (user.AnyTypeProp.Value != null) { writer.WritePropertyName("anyTypeProp"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 119231862b34..14e6bf888455 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -203,7 +203,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName);// 1 if (whale.HasBaleen.IsSet) + writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index 359fcb6ddeaa..a97aae2b9958 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -277,9 +277,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName);// 1 var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); if (typeRawValue != null) - writer.WriteString("type", typeRawValue); // 4 + writer.WriteString("type", typeRawValue); else writer.WriteNull("type"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 7ffb1675c0c9..5305591a209e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -231,7 +231,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBa { var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); if (zeroBasedEnumRawValue != null) - writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); // 4 + writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else writer.WriteNull("ZeroBasedEnum"); } From c2924163ce004fcf96f6ce2f9b8eaae738975013 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 29 Oct 2023 18:44:26 -0400 Subject: [PATCH 08/23] added backing property for not required properties --- .../languages/AbstractCSharpCodegen.java | 1 + .../templating/mustache/IndentedLambda.java | 2 +- .../csharp/NullConditionalProperty.mustache | 2 +- .../generichost/JsonConverter.mustache | 52 +++++++++--------- .../libraries/generichost/Option.mustache | 10 +--- .../generichost/WriteProperty.mustache | 2 +- .../generichost/WritePropertyHelper.mustache | 2 +- .../generichost/modelGeneric.mustache | 54 +++++++++++++++---- 8 files changed, 76 insertions(+), 49 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 6e466aa89041..ffe7d62a1054 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -437,6 +437,7 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda(true)) .put("copy", copyLambda) .put("copy2", copyLambda2) + .put("paste", new PasteLambda(copyLambda, true, true, true)) .put("pasteLine", new PasteLambda(copyLambda, true, true, false)) .put("pasteLine2", new PasteLambda(copyLambda2, true, true, false)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/IndentedLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/IndentedLambda.java index f90b662c6d63..09f669ae3bea 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/IndentedLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/IndentedLambda.java @@ -112,7 +112,7 @@ public void execute(Template.Fragment fragment, Writer writer) throws IOExceptio String prefixedIndention = StringUtils.repeat(new String(Character.toChars(spaceCode)), prefixSpaceCount); StringBuilder sb = new StringBuilder(); // use \n instead of System.lineSeparator (e.g. \r\n in Windows) as templates use \n - String[] lines = text.split("\n"); + String[] lines = text.split("\n", -1); for (int i = 0; i < lines.length; i++) { String line = lines[i]; // Mustache will apply correct indentation to the first line of a template (to match declaration location). diff --git a/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache index d8ad9266699e..64dd45277c77 100644 --- a/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache @@ -1 +1 @@ -{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}} \ No newline at end of file +{{#lambda.first}}{{#isNullable}}{{nrt?}} {{^nrt}}{{#vendorExtensions.x-is-value-type}}? {{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}{{^required}}{{nrt?}} {{^nrt}}{{#vendorExtensions.x-is-value-type}}? {{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/required}}{{/lambda.first}} \ No newline at end of file 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 5624ac4d7be4..9071043ea38f 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 @@ -270,18 +270,18 @@ {{/allVars}} {{#allVars}} {{^isNullable}} - if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value == null) + if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.IsSet && {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value == null) throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}), "Property is not nullable for class {{classname}}."); {{/isNullable}} {{/allVars}} {{#allVars}} {{#required}} - {{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}}; + // {{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}}; {{/required}} {{^required}} {{^isNullable}} - Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}> {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}>({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}); + // Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}> {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}>({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}); {{/isNullable}} {{/required}} {{#-last}} @@ -293,7 +293,7 @@ {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c {{#-last}} throw new JsonException(); @@ -304,19 +304,19 @@ {{^composedSchemas.oneOf}} {{^required}} {{#model.composedSchemas.anyOf}} - Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); + // Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); {{/model.composedSchemas.anyOf}} {{#-last}} {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} {{#oneOf}} if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // b {{#-last}} throw new JsonException(); @@ -382,7 +382,7 @@ {{#allVars}} {{^isNullable}} {{#vendorExtensions.x-is-reference-type}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} == null) + if ({{^required}}{{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet && {{/required}}{{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) throw new ArgumentNullException(nameof({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}), "Property is required for class {{classname}}."); {{/vendorExtensions.x-is-reference-type}} @@ -394,7 +394,7 @@ {{^isEnum}} {{^isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); // 1 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -405,7 +405,7 @@ {{/isString}} {{#isBoolean}} {{#lambda.copy}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}); + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}); // 2 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -414,7 +414,7 @@ {{^isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); // 3 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -423,7 +423,7 @@ {{/isEnum}} {{#isDate}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); // 4 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -431,7 +431,7 @@ {{/isDate}} {{#isDateTime}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); // 5 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -440,7 +440,7 @@ {{#isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}})); + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}})); // 6 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -449,7 +449,7 @@ {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); // 7 if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -462,7 +462,7 @@ {{/lambda.copy}} {{#required}} {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) // 8 writer.WriteNull("{{baseName}}"); else { @@ -485,7 +485,7 @@ } {{/isNullable}} {{^isNullable}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); // 9 {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -502,11 +502,11 @@ {{/required}} {{^required}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 10 {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value != null) // 10 a { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value.Value); + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value.Value); writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } else @@ -514,7 +514,7 @@ {{/isNullable}} {{^isNullable}} { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); // 10 b writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } {{/isNullable}} @@ -525,7 +525,7 @@ {{/isEnum}} {{#isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); // 11 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -540,7 +540,7 @@ {{^isDateTime}} {{#required}} {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) // 12 { writer.WritePropertyName("{{baseName}}"); JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); @@ -550,13 +550,13 @@ {{/isNullable}} {{^isNullable}} writer.WritePropertyName("{{baseName}}"); - JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); // 13 {{/isNullable}} {{/required}} {{^required}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 14 {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value != null) { writer.WritePropertyName("{{baseName}}"); JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache index d34126964b12..0283522d76c8 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache @@ -35,13 +35,7 @@ namespace {{packageName}}.{{clientPackage}} /// /// Implicitly converts this option to the contained type /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); + /// + public static implicit operator TType(Option option) => option.Value; } } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache index 673f988d1a53..6c9192d85977 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WriteProperty.mustache @@ -2,7 +2,7 @@ {{>WritePropertyHelper}} {{/required}} {{^required}} -if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.IsSet) +if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) {{#lambda.indent1}} {{>WritePropertyHelper}} {{/lambda.indent1}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache index 2b38a39edb47..8c8e7b4a704a 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/WritePropertyHelper.mustache @@ -1,5 +1,5 @@ {{#isNullable}} -if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}} != null) +if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{/required}} != null) {{#lambda.pasteLine}}{{/lambda.pasteLine}} else writer.WriteNull("{{baseName}}"); diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 8ac155899e40..40be3900826f 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -18,16 +18,16 @@ {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{{dataType}}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} {{#model.composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{dataType}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/model.composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{#parentModel.composedSchemas.oneOf}}{{#lambda.camelcase_param}}{{parent}}{{/lambda.camelcase_param}}.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{/parentModel.composedSchemas.oneOf}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} { {{#composedSchemas.anyOf}} - {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; + {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; {{/composedSchemas.anyOf}} - {{name}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; + {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; {{#allVars}} {{^isInherited}} - {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/isInherited}} {{#isInherited}} {{#isNew}} - {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/isNew}} {{/isInherited}} {{/allVars}} @@ -52,15 +52,15 @@ {{#model.vendorExtensions.x-model-is-mutatable}}{{>visibility}}{{/model.vendorExtensions.x-model-is-mutatable}}{{^model.vendorExtensions.x-model-is-mutatable}}internal{{/model.vendorExtensions.x-model-is-mutatable}} {{classname}}({{#lambda.joinWithComma}}{{#composedSchemas.anyOf}}{{^required}}Option<{{/required}}{{{name}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} {{/composedSchemas.anyOf}}{{>ModelSignature}}{{/lambda.joinWithComma}}){{#parent}} : base({{#lambda.joinWithComma}}{{>ModelBaseSignature}}{{/lambda.joinWithComma}}){{/parent}} { {{#composedSchemas.anyOf}} - {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{#lambda.titlecase}}{{name}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/composedSchemas.anyOf}} {{#allVars}} {{^isInherited}} - {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/isInherited}} {{#isInherited}} {{#isNew}} - {{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; + {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/isNew}} {{/isInherited}} {{/allVars}} @@ -84,6 +84,14 @@ {{/complexType}} {{/isEnum}} {{#isEnum}} + {{^required}} + /// + /// Used to track the state of {{{name}}} + /// + [JsonIgnore] + public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option a + + {{/required}} /// /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} /// @@ -97,12 +105,20 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{#isNew}}new {{/isNew}}{{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // a {{/isEnum}} {{/vars}} {{#composedSchemas.anyOf}} {{^vendorExtensions.x-duplicated-data-type}} + {{^required}} + /// + /// Used to track the state of {{{name}}} + /// + [JsonIgnore] + public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option b + + {{/required}} /// /// {{description}}{{^description}}Gets or Sets {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{/description}} /// {{#description}} @@ -113,7 +129,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = value; } {{/isReadOnly}}}{{/required}} // b {{/vendorExtensions.x-duplicated-data-type}} {{/composedSchemas.anyOf}} @@ -137,6 +153,14 @@ {{^isEnum}} {{#isInherited}} {{#isNew}} + {{^required}} + /// + /// Used to track the state of {{{name}}} + /// + [JsonIgnore] + public new Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option c + + {{/required}} /// /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} /// {{#description}} @@ -148,11 +172,19 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public new {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // c {{/isNew}} {{/isInherited}} {{^isInherited}} + {{^required}} + /// + /// Used to track the state of {{{name}}} + /// + [JsonIgnore] + public Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option d + + {{/required}} /// /// {{description}}{{^description}}Gets or Sets {{{name}}}{{/description}} /// {{#description}} @@ -164,7 +196,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{^required}}Option<{{/required}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}}{{^required}}>{{/required}} {{name}} { get; {{^isReadOnly}}set; {{/isReadOnly}}} + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // d {{/isInherited}} {{/isEnum}} From dac68599826348cf45c90c01fc5c4020cfde706b Mon Sep 17 00:00:00 2001 From: devhl Date: Tue, 31 Oct 2023 20:35:20 -0400 Subject: [PATCH 09/23] more not required and nullable hanlding improvements --- .../resources/csharp/ValidateRegex.mustache | 2 +- .../generichost/JsonConverter.mustache | 33 ++++++++++--------- .../generichost/modelGeneric.mustache | 2 +- .../resources/csharp/validatable.mustache | 8 ++--- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache index 76bb9f798f0c..014af91d9efc 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache @@ -1,6 +1,6 @@ // {{{name}}} ({{{dataType}}}) pattern Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); -if (!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) +if (!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); } \ No newline at end of file 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 9071043ea38f..a12d6047fb8b 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 @@ -293,7 +293,7 @@ {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c {{#-last}} throw new JsonException(); @@ -305,18 +305,21 @@ {{^required}} {{#model.composedSchemas.anyOf}} // Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); + Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} == null + ? default + : new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); {{/model.composedSchemas.anyOf}} {{#-last}} {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} {{#oneOf}} if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}}{{^required}}{{^isNullable}}ParsedValue{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // b + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // b {{#-last}} throw new JsonException(); @@ -354,10 +357,10 @@ {{^model.discriminator}} {{#composedSchemas}} {{#anyOf}} - if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}.IsSet {{/required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}} != null{{/lambda.joinWithAmpersand}}) + if ({{#lambda.joinWithAmpersand}}{{^required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}Option.IsSet {{/required}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}Option.Value{{/required}} != null{{/lambda.joinWithAmpersand}}) { - {{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}}.GetType())); - {{datatypeWithEnum}}JsonConverter.WriteProperties(ref writer, {{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}.Value{{/required}}, jsonSerializerOptions); + {{datatypeWithEnum}}JsonConverter {{datatypeWithEnum}}JsonConverter = ({{datatypeWithEnum}}JsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}Option.Value{{/required}}.GetType())); + {{datatypeWithEnum}}JsonConverter.WriteProperties(ref writer, {{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}.{{datatypeWithEnum}}{{^required}}Option.Value{{/required}}, jsonSerializerOptions); } {{/anyOf}} @@ -405,7 +408,7 @@ {{/isString}} {{#isBoolean}} {{#lambda.copy}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}); // 2 + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -414,7 +417,7 @@ {{^isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); // 3 + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -423,7 +426,7 @@ {{/isEnum}} {{#isDate}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); // 4 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -431,7 +434,7 @@ {{/isDate}} {{#isDateTime}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}.ToString({{name}}Format)); // 5 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -440,7 +443,7 @@ {{#isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}})); // 6 + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -449,7 +452,7 @@ {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}); // 7 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 7 if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -466,7 +469,7 @@ writer.WriteNull("{{baseName}}"); else { - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -485,7 +488,7 @@ } {{/isNullable}} {{^isNullable}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{#isNullable}}.Value{{/isNullable}}); // 9 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); // 9 {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -525,7 +528,7 @@ {{/isEnum}} {{#isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}.Value{{/required}}{{#isNullable}}.Value{{/isNullable}}); // 11 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 40be3900826f..ac64f42e60a7 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -129,7 +129,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = value; } {{/isReadOnly}}}{{/required}} // b + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new(value); } {{/isReadOnly}}}{{/required}} // b {{/vendorExtensions.x-duplicated-data-type}} {{/composedSchemas.anyOf}} diff --git a/modules/openapi-generator/src/main/resources/csharp/validatable.mustache b/modules/openapi-generator/src/main/resources/csharp/validatable.mustache index 5589fcb0d4bc..b06b98fc636c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/validatable.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/validatable.mustache @@ -78,7 +78,7 @@ {{/minLength}} {{#maximum}} // {{{name}}} ({{{dataType}}}) maximum - if ({{#useGenericHost}}{{^required}}this.{{{name}}}.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} > ({{{dataType}}}){{maximum}}) + if ({{#useGenericHost}}{{^required}}this.{{{name}}}Option.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} > ({{{dataType}}}){{maximum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value less than or equal to {{maximum}}.", new [] { "{{{name}}}" }); } @@ -86,7 +86,7 @@ {{/maximum}} {{#minimum}} // {{{name}}} ({{{dataType}}}) minimum - if ({{#useGenericHost}}{{^required}}this.{{{name}}}.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} < ({{{dataType}}}){{minimum}}) + if ({{#useGenericHost}}{{^required}}this.{{{name}}}Option.IsSet && {{/required}}{{/useGenericHost}}this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} < ({{{dataType}}}){{minimum}}) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must be a value greater than or equal to {{minimum}}.", new [] { "{{{name}}}" }); } @@ -96,7 +96,7 @@ {{^isByteArray}} {{#vendorExtensions.x-is-value-type}} {{#isNullable}} - if (this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} != null){ + if (this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null){ {{#lambda.trimTrailingWithNewLine}} {{#lambda.indent4}} {{>ValidateRegex}} @@ -116,7 +116,7 @@ {{/isNullable}} {{/vendorExtensions.x-is-value-type}} {{^vendorExtensions.x-is-value-type}} - if (this.{{{name}}}{{#useGenericHost}}{{^required}}.Value{{/required}}{{/useGenericHost}} != null) { + if (this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null) { {{#lambda.trimTrailingWithNewLine}} {{#lambda.indent4}} {{>ValidateRegex}} From 40164d5a1fa21d8cb5d352f6e464ea3c361a426a Mon Sep 17 00:00:00 2001 From: devhl Date: Tue, 31 Oct 2023 20:36:58 -0400 Subject: [PATCH 10/23] revert sample updates for a merge master --- .../.openapi-generator/FILES | 2 - .../README.md | 1 - .../api/openapi.yaml | 258 -- .../docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1954 --------------- .../UnitTest1.cs | 19 +- .../UnitTest1.cs | 17 +- .../.openapi-generator/FILES | 2 - .../api/openapi.yaml | 258 -- .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 - .../Api/FakeApiTests.cs | 10 - .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ---- .../UseSourceGeneration/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 2 - .../src/UseSourceGeneration/Client/Option.cs | 12 - .../src/UseSourceGeneration/Model/Activity.cs | 24 +- .../ActivityOutputElementRepresentation.cs | 40 +- .../Model/AdditionalPropertiesClass.cs | 154 +- .../src/UseSourceGeneration/Model/Animal.cs | 38 +- .../UseSourceGeneration/Model/ApiResponse.cs | 51 +- .../src/UseSourceGeneration/Model/Apple.cs | 66 +- .../src/UseSourceGeneration/Model/AppleReq.cs | 35 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 24 +- .../Model/ArrayOfNumberOnly.cs | 24 +- .../UseSourceGeneration/Model/ArrayTest.cs | 62 +- .../src/UseSourceGeneration/Model/Banana.cs | 19 +- .../UseSourceGeneration/Model/BananaReq.cs | 32 +- .../UseSourceGeneration/Model/BasquePig.cs | 18 +- .../Model/Capitalization.cs | 102 +- .../src/UseSourceGeneration/Model/Cat.cs | 49 +- .../src/UseSourceGeneration/Model/Category.cs | 55 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 37 +- .../UseSourceGeneration/Model/ClassModel.cs | 22 +- .../Model/ComplexQuadrilateral.cs | 36 +- .../UseSourceGeneration/Model/DanishPig.cs | 18 +- .../Model/DateOnlyClass.cs | 19 +- .../Model/DeprecatedObject.cs | 22 +- .../src/UseSourceGeneration/Model/Dog.cs | 58 +- .../src/UseSourceGeneration/Model/Drawing.cs | 75 +- .../UseSourceGeneration/Model/EnumArrays.cs | 41 +- .../src/UseSourceGeneration/Model/EnumTest.cs | 497 ++-- .../Model/EquilateralTriangle.cs | 36 +- .../src/UseSourceGeneration/Model/File.cs | 22 +- .../Model/FileSchemaTestClass.cs | 43 +- .../src/UseSourceGeneration/Model/Foo.cs | 22 +- .../Model/FooGetDefaultResponse.cs | 24 +- .../UseSourceGeneration/Model/FormatTest.cs | 431 ++-- .../src/UseSourceGeneration/Model/Fruit.cs | 26 +- .../src/UseSourceGeneration/Model/GmFruit.cs | 41 +- .../Model/GrandparentAnimal.cs | 18 +- .../Model/HasOnlyReadOnly.cs | 38 +- .../Model/HealthCheckResult.cs | 14 +- .../Model/IsoscelesTriangle.cs | 36 +- .../src/UseSourceGeneration/Model/List.cs | 22 +- .../Model/LiteralStringClass.cs | 38 +- .../src/UseSourceGeneration/Model/Mammal.cs | 22 +- .../src/UseSourceGeneration/Model/MapTest.cs | 82 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 66 +- .../Model/Model200Response.cs | 35 +- .../UseSourceGeneration/Model/ModelClient.cs | 22 +- .../src/UseSourceGeneration/Model/Name.cs | 61 +- ...cationtestGetElementsV1ResponseMPayload.cs | 30 +- .../Model/NullableClass.cs | 195 +- .../Model/NullableGuidClass.cs | 18 +- .../Model/NullableShape.cs | 20 +- .../UseSourceGeneration/Model/NumberOnly.cs | 19 +- .../Model/ObjectWithDeprecatedFields.cs | 73 +- .../src/UseSourceGeneration/Model/Order.cs | 89 +- .../Model/OuterComposite.cs | 48 +- .../UseSourceGeneration/Model/ParentPet.cs | 18 +- .../src/UseSourceGeneration/Model/Pet.cs | 149 +- .../src/UseSourceGeneration/Model/Pig.cs | 20 +- .../Model/Quadrilateral.cs | 20 +- .../Model/QuadrilateralInterface.cs | 18 +- .../Model/ReadOnlyFirst.cs | 38 +- .../Model/RequiredClass.cs | 2212 ----------------- .../src/UseSourceGeneration/Model/Return.cs | 19 +- .../Model/RolesReportsHash.cs | 38 +- .../Model/RolesReportsHashRole.cs | 22 +- .../Model/ScaleneTriangle.cs | 36 +- .../src/UseSourceGeneration/Model/Shape.cs | 20 +- .../Model/ShapeInterface.cs | 18 +- .../UseSourceGeneration/Model/ShapeOrNull.cs | 20 +- .../Model/SimpleQuadrilateral.cs | 36 +- .../Model/SpecialModelName.cs | 35 +- .../src/UseSourceGeneration/Model/Tag.cs | 35 +- .../Model/TestCollectionEndingWithWordList.cs | 22 +- .../TestCollectionEndingWithWordListObject.cs | 24 +- ...lineFreeformAdditionalPropertiesRequest.cs | 22 +- .../src/UseSourceGeneration/Model/Triangle.cs | 22 +- .../Model/TriangleInterface.cs | 18 +- .../src/UseSourceGeneration/Model/User.cs | 194 +- .../src/UseSourceGeneration/Model/Whale.cs | 48 +- .../src/UseSourceGeneration/Model/Zebra.cs | 37 +- .../Model/ZeroBasedEnumClass.cs | 23 +- .../.openapi-generator/FILES | 2 - .../api/openapi.yaml | 258 -- .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 - .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 - .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ---- .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 - .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Activity.cs | 25 +- .../ActivityOutputElementRepresentation.cs | 41 +- .../Model/AdditionalPropertiesClass.cs | 155 +- .../src/Org.OpenAPITools/Model/Animal.cs | 39 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 52 +- .../src/Org.OpenAPITools/Model/Apple.cs | 67 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 36 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 25 +- .../Model/ArrayOfNumberOnly.cs | 25 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 63 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 33 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 19 +- .../Org.OpenAPITools/Model/Capitalization.cs | 103 +- .../src/Org.OpenAPITools/Model/Cat.cs | 50 +- .../src/Org.OpenAPITools/Model/Category.cs | 56 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 38 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 23 +- .../Model/ComplexQuadrilateral.cs | 37 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 19 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 20 +- .../Model/DeprecatedObject.cs | 23 +- .../src/Org.OpenAPITools/Model/Dog.cs | 59 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 76 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 42 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 498 ++-- .../Model/EquilateralTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/File.cs | 23 +- .../Model/FileSchemaTestClass.cs | 44 +- .../src/Org.OpenAPITools/Model/Foo.cs | 23 +- .../Model/FooGetDefaultResponse.cs | 25 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 432 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 27 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 - .../src/Org.OpenAPITools/Model/GmFruit.cs | 42 +- .../Model/GrandparentAnimal.cs | 19 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 39 +- .../Model/HealthCheckResult.cs | 15 +- .../Model/IsoscelesTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/List.cs | 23 +- .../Model/LiteralStringClass.cs | 39 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 23 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 83 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 67 +- .../Model/Model200Response.cs | 36 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 23 +- .../src/Org.OpenAPITools/Model/Name.cs | 62 +- ...cationtestGetElementsV1ResponseMPayload.cs | 31 +- .../Org.OpenAPITools/Model/NullableClass.cs | 196 +- .../Model/NullableGuidClass.cs | 19 +- .../Org.OpenAPITools/Model/NullableShape.cs | 21 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 20 +- .../Model/ObjectWithDeprecatedFields.cs | 74 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 - .../src/Org.OpenAPITools/Model/Order.cs | 90 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 49 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 - .../Model/OuterEnumDefaultValue.cs | 1 - .../Model/OuterEnumInteger.cs | 1 - .../Model/OuterEnumIntegerDefaultValue.cs | 1 - .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 - .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- .../src/Org.OpenAPITools/Model/Pet.cs | 150 +- .../src/Org.OpenAPITools/Model/Pig.cs | 21 +- .../Model/PolymorphicProperty.cs | 1 - .../Org.OpenAPITools/Model/Quadrilateral.cs | 21 +- .../Model/QuadrilateralInterface.cs | 19 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 39 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2204 ---------------- .../src/Org.OpenAPITools/Model/Return.cs | 20 +- .../Model/RolesReportsHash.cs | 39 +- .../Model/RolesReportsHashRole.cs | 23 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/Shape.cs | 21 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 21 +- .../Model/SimpleQuadrilateral.cs | 37 +- .../Model/SpecialModelName.cs | 36 +- .../src/Org.OpenAPITools/Model/Tag.cs | 36 +- .../Model/TestCollectionEndingWithWordList.cs | 23 +- .../TestCollectionEndingWithWordListObject.cs | 25 +- ...lineFreeformAdditionalPropertiesRequest.cs | 23 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 23 +- .../Model/TriangleInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/User.cs | 195 +- .../src/Org.OpenAPITools/Model/Whale.cs | 49 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 38 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 - .../Model/ZeroBasedEnumClass.cs | 24 +- .../.openapi-generator/FILES | 2 - .../api/openapi.yaml | 258 -- .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 - .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 - .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ---- .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 - .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Activity.cs | 25 +- .../ActivityOutputElementRepresentation.cs | 41 +- .../Model/AdditionalPropertiesClass.cs | 155 +- .../src/Org.OpenAPITools/Model/Animal.cs | 39 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 52 +- .../src/Org.OpenAPITools/Model/Apple.cs | 67 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 36 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 25 +- .../Model/ArrayOfNumberOnly.cs | 25 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 63 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 33 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 19 +- .../Org.OpenAPITools/Model/Capitalization.cs | 103 +- .../src/Org.OpenAPITools/Model/Cat.cs | 50 +- .../src/Org.OpenAPITools/Model/Category.cs | 56 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 38 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 23 +- .../Model/ComplexQuadrilateral.cs | 37 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 19 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 20 +- .../Model/DeprecatedObject.cs | 23 +- .../src/Org.OpenAPITools/Model/Dog.cs | 59 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 76 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 42 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 498 ++-- .../Model/EquilateralTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/File.cs | 23 +- .../Model/FileSchemaTestClass.cs | 44 +- .../src/Org.OpenAPITools/Model/Foo.cs | 23 +- .../Model/FooGetDefaultResponse.cs | 25 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 432 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 27 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 - .../src/Org.OpenAPITools/Model/GmFruit.cs | 42 +- .../Model/GrandparentAnimal.cs | 19 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 39 +- .../Model/HealthCheckResult.cs | 15 +- .../Model/IsoscelesTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/List.cs | 23 +- .../Model/LiteralStringClass.cs | 39 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 23 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 83 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 67 +- .../Model/Model200Response.cs | 36 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 23 +- .../src/Org.OpenAPITools/Model/Name.cs | 62 +- ...cationtestGetElementsV1ResponseMPayload.cs | 31 +- .../Org.OpenAPITools/Model/NullableClass.cs | 196 +- .../Model/NullableGuidClass.cs | 19 +- .../Org.OpenAPITools/Model/NullableShape.cs | 21 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 20 +- .../Model/ObjectWithDeprecatedFields.cs | 74 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 - .../src/Org.OpenAPITools/Model/Order.cs | 90 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 49 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 - .../Model/OuterEnumDefaultValue.cs | 1 - .../Model/OuterEnumInteger.cs | 1 - .../Model/OuterEnumIntegerDefaultValue.cs | 1 - .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 - .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- .../src/Org.OpenAPITools/Model/Pet.cs | 150 +- .../src/Org.OpenAPITools/Model/Pig.cs | 21 +- .../Model/PolymorphicProperty.cs | 1 - .../Org.OpenAPITools/Model/Quadrilateral.cs | 21 +- .../Model/QuadrilateralInterface.cs | 19 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 39 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2202 ---------------- .../src/Org.OpenAPITools/Model/Return.cs | 20 +- .../Model/RolesReportsHash.cs | 39 +- .../Model/RolesReportsHashRole.cs | 23 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/Shape.cs | 21 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 21 +- .../Model/SimpleQuadrilateral.cs | 37 +- .../Model/SpecialModelName.cs | 36 +- .../src/Org.OpenAPITools/Model/Tag.cs | 36 +- .../Model/TestCollectionEndingWithWordList.cs | 23 +- .../TestCollectionEndingWithWordListObject.cs | 25 +- ...lineFreeformAdditionalPropertiesRequest.cs | 23 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 23 +- .../Model/TriangleInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/User.cs | 195 +- .../src/Org.OpenAPITools/Model/Whale.cs | 49 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 38 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 - .../Model/ZeroBasedEnumClass.cs | 24 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Adult.cs | 68 +- .../src/Org.OpenAPITools/Model/Child.cs | 75 +- .../src/Org.OpenAPITools/Model/Person.cs | 55 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Apple.cs | 23 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 42 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Apple.cs | 23 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 27 +- .../.openapi-generator/FILES | 2 - .../api/openapi.yaml | 258 -- .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 - .../Org.OpenAPITools.Test/Api/FakeApiTests.cs | 10 - .../Model/CategoryTests.cs | 12 +- .../Model/EnumTestTests.cs | 18 +- .../Model/FormatTestTests.cs | 54 +- .../Org.OpenAPITools.Test/Model/PetTests.cs | 24 +- .../Model/RequiredClassTests.cs | 452 ---- .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 - .../src/Org.OpenAPITools/Client/Option.cs | 12 - .../src/Org.OpenAPITools/Model/Activity.cs | 25 +- .../ActivityOutputElementRepresentation.cs | 41 +- .../Model/AdditionalPropertiesClass.cs | 155 +- .../src/Org.OpenAPITools/Model/Animal.cs | 39 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 52 +- .../src/Org.OpenAPITools/Model/Apple.cs | 67 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 36 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 25 +- .../Model/ArrayOfNumberOnly.cs | 25 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 63 +- .../src/Org.OpenAPITools/Model/Banana.cs | 20 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 33 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 19 +- .../Org.OpenAPITools/Model/Capitalization.cs | 103 +- .../src/Org.OpenAPITools/Model/Cat.cs | 50 +- .../src/Org.OpenAPITools/Model/Category.cs | 56 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 38 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 23 +- .../Model/ComplexQuadrilateral.cs | 37 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 19 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 20 +- .../Model/DeprecatedObject.cs | 23 +- .../src/Org.OpenAPITools/Model/Dog.cs | 59 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 76 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 42 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 - .../src/Org.OpenAPITools/Model/EnumTest.cs | 498 ++-- .../Model/EquilateralTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/File.cs | 23 +- .../Model/FileSchemaTestClass.cs | 44 +- .../src/Org.OpenAPITools/Model/Foo.cs | 23 +- .../Model/FooGetDefaultResponse.cs | 25 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 432 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 27 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 1 - .../src/Org.OpenAPITools/Model/GmFruit.cs | 42 +- .../Model/GrandparentAnimal.cs | 19 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 39 +- .../Model/HealthCheckResult.cs | 15 +- .../Model/IsoscelesTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/List.cs | 23 +- .../Model/LiteralStringClass.cs | 39 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 23 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 83 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 67 +- .../Model/Model200Response.cs | 36 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 23 +- .../src/Org.OpenAPITools/Model/Name.cs | 62 +- ...cationtestGetElementsV1ResponseMPayload.cs | 31 +- .../Org.OpenAPITools/Model/NullableClass.cs | 196 +- .../Model/NullableGuidClass.cs | 19 +- .../Org.OpenAPITools/Model/NullableShape.cs | 21 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 20 +- .../Model/ObjectWithDeprecatedFields.cs | 74 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 1 - .../src/Org.OpenAPITools/Model/Order.cs | 90 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 49 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 - .../Model/OuterEnumDefaultValue.cs | 1 - .../Model/OuterEnumInteger.cs | 1 - .../Model/OuterEnumIntegerDefaultValue.cs | 1 - .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 - .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- 407 files changed, 6700 insertions(+), 22768 deletions(-) delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index 1e54de3472d2..ddeca89d213f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -199,7 +198,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md index c2d5ddeb3539..af827f28641e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md @@ -221,7 +221,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index a3bfdf702066..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1954 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger - { - get{ return _RequiredNullableEnumInteger;} - set - { - _RequiredNullableEnumInteger = value; - _flagRequiredNullableEnumInteger = true; - } - } - private RequiredNullableEnumIntegerEnum _RequiredNullableEnumInteger; - private bool _flagRequiredNullableEnumInteger; - - /// - /// Returns false as RequiredNullableEnumInteger should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableEnumInteger() - { - return _flagRequiredNullableEnumInteger; - } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger - { - get{ return _RequiredNotnullableEnumInteger;} - set - { - _RequiredNotnullableEnumInteger = value; - _flagRequiredNotnullableEnumInteger = true; - } - } - private RequiredNotnullableEnumIntegerEnum _RequiredNotnullableEnumInteger; - private bool _flagRequiredNotnullableEnumInteger; - - /// - /// Returns false as RequiredNotnullableEnumInteger should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableEnumInteger() - { - return _flagRequiredNotnullableEnumInteger; - } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger - { - get{ return _NotrequiredNullableEnumInteger;} - set - { - _NotrequiredNullableEnumInteger = value; - _flagNotrequiredNullableEnumInteger = true; - } - } - private NotrequiredNullableEnumIntegerEnum? _NotrequiredNullableEnumInteger; - private bool _flagNotrequiredNullableEnumInteger; - - /// - /// Returns false as NotrequiredNullableEnumInteger should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableEnumInteger() - { - return _flagNotrequiredNullableEnumInteger; - } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger - { - get{ return _NotrequiredNotnullableEnumInteger;} - set - { - _NotrequiredNotnullableEnumInteger = value; - _flagNotrequiredNotnullableEnumInteger = true; - } - } - private NotrequiredNotnullableEnumIntegerEnum? _NotrequiredNotnullableEnumInteger; - private bool _flagNotrequiredNotnullableEnumInteger; - - /// - /// Returns false as NotrequiredNotnullableEnumInteger should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableEnumInteger() - { - return _flagNotrequiredNotnullableEnumInteger; - } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly - { - get{ return _RequiredNullableEnumIntegerOnly;} - set - { - _RequiredNullableEnumIntegerOnly = value; - _flagRequiredNullableEnumIntegerOnly = true; - } - } - private RequiredNullableEnumIntegerOnlyEnum _RequiredNullableEnumIntegerOnly; - private bool _flagRequiredNullableEnumIntegerOnly; - - /// - /// Returns false as RequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableEnumIntegerOnly() - { - return _flagRequiredNullableEnumIntegerOnly; - } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly - { - get{ return _RequiredNotnullableEnumIntegerOnly;} - set - { - _RequiredNotnullableEnumIntegerOnly = value; - _flagRequiredNotnullableEnumIntegerOnly = true; - } - } - private RequiredNotnullableEnumIntegerOnlyEnum _RequiredNotnullableEnumIntegerOnly; - private bool _flagRequiredNotnullableEnumIntegerOnly; - - /// - /// Returns false as RequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableEnumIntegerOnly() - { - return _flagRequiredNotnullableEnumIntegerOnly; - } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly - { - get{ return _NotrequiredNullableEnumIntegerOnly;} - set - { - _NotrequiredNullableEnumIntegerOnly = value; - _flagNotrequiredNullableEnumIntegerOnly = true; - } - } - private NotrequiredNullableEnumIntegerOnlyEnum? _NotrequiredNullableEnumIntegerOnly; - private bool _flagNotrequiredNullableEnumIntegerOnly; - - /// - /// Returns false as NotrequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableEnumIntegerOnly() - { - return _flagNotrequiredNullableEnumIntegerOnly; - } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly - { - get{ return _NotrequiredNotnullableEnumIntegerOnly;} - set - { - _NotrequiredNotnullableEnumIntegerOnly = value; - _flagNotrequiredNotnullableEnumIntegerOnly = true; - } - } - private NotrequiredNotnullableEnumIntegerOnlyEnum? _NotrequiredNotnullableEnumIntegerOnly; - private bool _flagNotrequiredNotnullableEnumIntegerOnly; - - /// - /// Returns false as NotrequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableEnumIntegerOnly() - { - return _flagNotrequiredNotnullableEnumIntegerOnly; - } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString - { - get{ return _RequiredNotnullableEnumString;} - set - { - _RequiredNotnullableEnumString = value; - _flagRequiredNotnullableEnumString = true; - } - } - private RequiredNotnullableEnumStringEnum _RequiredNotnullableEnumString; - private bool _flagRequiredNotnullableEnumString; - - /// - /// Returns false as RequiredNotnullableEnumString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableEnumString() - { - return _flagRequiredNotnullableEnumString; - } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString - { - get{ return _RequiredNullableEnumString;} - set - { - _RequiredNullableEnumString = value; - _flagRequiredNullableEnumString = true; - } - } - private RequiredNullableEnumStringEnum _RequiredNullableEnumString; - private bool _flagRequiredNullableEnumString; - - /// - /// Returns false as RequiredNullableEnumString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableEnumString() - { - return _flagRequiredNullableEnumString; - } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString - { - get{ return _NotrequiredNullableEnumString;} - set - { - _NotrequiredNullableEnumString = value; - _flagNotrequiredNullableEnumString = true; - } - } - private NotrequiredNullableEnumStringEnum? _NotrequiredNullableEnumString; - private bool _flagNotrequiredNullableEnumString; - - /// - /// Returns false as NotrequiredNullableEnumString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableEnumString() - { - return _flagNotrequiredNullableEnumString; - } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString - { - get{ return _NotrequiredNotnullableEnumString;} - set - { - _NotrequiredNotnullableEnumString = value; - _flagNotrequiredNotnullableEnumString = true; - } - } - private NotrequiredNotnullableEnumStringEnum? _NotrequiredNotnullableEnumString; - private bool _flagNotrequiredNotnullableEnumString; - - /// - /// Returns false as NotrequiredNotnullableEnumString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableEnumString() - { - return _flagNotrequiredNotnullableEnumString; - } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue - { - get{ return _RequiredNullableOuterEnumDefaultValue;} - set - { - _RequiredNullableOuterEnumDefaultValue = value; - _flagRequiredNullableOuterEnumDefaultValue = true; - } - } - private OuterEnumDefaultValue _RequiredNullableOuterEnumDefaultValue; - private bool _flagRequiredNullableOuterEnumDefaultValue; - - /// - /// Returns false as RequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableOuterEnumDefaultValue() - { - return _flagRequiredNullableOuterEnumDefaultValue; - } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue - { - get{ return _RequiredNotnullableOuterEnumDefaultValue;} - set - { - _RequiredNotnullableOuterEnumDefaultValue = value; - _flagRequiredNotnullableOuterEnumDefaultValue = true; - } - } - private OuterEnumDefaultValue _RequiredNotnullableOuterEnumDefaultValue; - private bool _flagRequiredNotnullableOuterEnumDefaultValue; - - /// - /// Returns false as RequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableOuterEnumDefaultValue() - { - return _flagRequiredNotnullableOuterEnumDefaultValue; - } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue - { - get{ return _NotrequiredNullableOuterEnumDefaultValue;} - set - { - _NotrequiredNullableOuterEnumDefaultValue = value; - _flagNotrequiredNullableOuterEnumDefaultValue = true; - } - } - private OuterEnumDefaultValue? _NotrequiredNullableOuterEnumDefaultValue; - private bool _flagNotrequiredNullableOuterEnumDefaultValue; - - /// - /// Returns false as NotrequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableOuterEnumDefaultValue() - { - return _flagNotrequiredNullableOuterEnumDefaultValue; - } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue - { - get{ return _NotrequiredNotnullableOuterEnumDefaultValue;} - set - { - _NotrequiredNotnullableOuterEnumDefaultValue = value; - _flagNotrequiredNotnullableOuterEnumDefaultValue = true; - } - } - private OuterEnumDefaultValue? _NotrequiredNotnullableOuterEnumDefaultValue; - private bool _flagNotrequiredNotnullableOuterEnumDefaultValue; - - /// - /// Returns false as NotrequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableOuterEnumDefaultValue() - { - return _flagNotrequiredNotnullableOuterEnumDefaultValue; - } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableIntegerProp = requiredNullableIntegerProp; - this._RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableBooleanProp = requiredNullableBooleanProp; - this._RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableDateProp = requiredNullableDateProp; - this._RequiredNotNullableDateProp = requiredNotNullableDateProp; - this._RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this._RequiredNullableEnumInteger = requiredNullableEnumInteger; - this._RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this._RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this._RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this._RequiredNotnullableEnumString = requiredNotnullableEnumString; - this._RequiredNullableEnumString = requiredNullableEnumString; - this._RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this._RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableUuid = requiredNullableUuid; - this._RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this._RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this._RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this._NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - if (this.NotRequiredNullableIntegerProp != null) - { - this._flagNotRequiredNullableIntegerProp = true; - } - this._NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - if (this.NotRequiredNotnullableintegerProp != null) - { - this._flagNotRequiredNotnullableintegerProp = true; - } - this._NotrequiredNullableStringProp = notrequiredNullableStringProp; - if (this.NotrequiredNullableStringProp != null) - { - this._flagNotrequiredNullableStringProp = true; - } - this._NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - if (this.NotrequiredNotnullableStringProp != null) - { - this._flagNotrequiredNotnullableStringProp = true; - } - this._NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - if (this.NotrequiredNullableBooleanProp != null) - { - this._flagNotrequiredNullableBooleanProp = true; - } - this._NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - if (this.NotrequiredNotnullableBooleanProp != null) - { - this._flagNotrequiredNotnullableBooleanProp = true; - } - this._NotRequiredNullableDateProp = notRequiredNullableDateProp; - if (this.NotRequiredNullableDateProp != null) - { - this._flagNotRequiredNullableDateProp = true; - } - this._NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - if (this.NotRequiredNotnullableDateProp != null) - { - this._flagNotRequiredNotnullableDateProp = true; - } - this._NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - if (this.NotrequiredNullableDatetimeProp != null) - { - this._flagNotrequiredNullableDatetimeProp = true; - } - this._NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - if (this.NotrequiredNotnullableDatetimeProp != null) - { - this._flagNotrequiredNotnullableDatetimeProp = true; - } - this._NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - if (this.NotrequiredNullableEnumInteger != null) - { - this._flagNotrequiredNullableEnumInteger = true; - } - this._NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - if (this.NotrequiredNotnullableEnumInteger != null) - { - this._flagNotrequiredNotnullableEnumInteger = true; - } - this._NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - if (this.NotrequiredNullableEnumIntegerOnly != null) - { - this._flagNotrequiredNullableEnumIntegerOnly = true; - } - this._NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - if (this.NotrequiredNotnullableEnumIntegerOnly != null) - { - this._flagNotrequiredNotnullableEnumIntegerOnly = true; - } - this._NotrequiredNullableEnumString = notrequiredNullableEnumString; - if (this.NotrequiredNullableEnumString != null) - { - this._flagNotrequiredNullableEnumString = true; - } - this._NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - if (this.NotrequiredNotnullableEnumString != null) - { - this._flagNotrequiredNotnullableEnumString = true; - } - this._NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - if (this.NotrequiredNullableOuterEnumDefaultValue != null) - { - this._flagNotrequiredNullableOuterEnumDefaultValue = true; - } - this._NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - if (this.NotrequiredNotnullableOuterEnumDefaultValue != null) - { - this._flagNotrequiredNotnullableOuterEnumDefaultValue = true; - } - this._NotrequiredNullableUuid = notrequiredNullableUuid; - if (this.NotrequiredNullableUuid != null) - { - this._flagNotrequiredNullableUuid = true; - } - this._NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - if (this.NotrequiredNotnullableUuid != null) - { - this._flagNotrequiredNotnullableUuid = true; - } - this._NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - if (this.NotrequiredNullableArrayOfString != null) - { - this._flagNotrequiredNullableArrayOfString = true; - } - this._NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - if (this.NotrequiredNotnullableArrayOfString != null) - { - this._flagNotrequiredNotnullableArrayOfString = true; - } - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp - { - get{ return _RequiredNullableIntegerProp;} - set - { - _RequiredNullableIntegerProp = value; - _flagRequiredNullableIntegerProp = true; - } - } - private int? _RequiredNullableIntegerProp; - private bool _flagRequiredNullableIntegerProp; - - /// - /// Returns false as RequiredNullableIntegerProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableIntegerProp() - { - return _flagRequiredNullableIntegerProp; - } - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp - { - get{ return _RequiredNotnullableintegerProp;} - set - { - _RequiredNotnullableintegerProp = value; - _flagRequiredNotnullableintegerProp = true; - } - } - private int _RequiredNotnullableintegerProp; - private bool _flagRequiredNotnullableintegerProp; - - /// - /// Returns false as RequiredNotnullableintegerProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableintegerProp() - { - return _flagRequiredNotnullableintegerProp; - } - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp - { - get{ return _NotRequiredNullableIntegerProp;} - set - { - _NotRequiredNullableIntegerProp = value; - _flagNotRequiredNullableIntegerProp = true; - } - } - private int? _NotRequiredNullableIntegerProp; - private bool _flagNotRequiredNullableIntegerProp; - - /// - /// Returns false as NotRequiredNullableIntegerProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotRequiredNullableIntegerProp() - { - return _flagNotRequiredNullableIntegerProp; - } - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp - { - get{ return _NotRequiredNotnullableintegerProp;} - set - { - _NotRequiredNotnullableintegerProp = value; - _flagNotRequiredNotnullableintegerProp = true; - } - } - private int _NotRequiredNotnullableintegerProp; - private bool _flagNotRequiredNotnullableintegerProp; - - /// - /// Returns false as NotRequiredNotnullableintegerProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotRequiredNotnullableintegerProp() - { - return _flagNotRequiredNotnullableintegerProp; - } - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp - { - get{ return _RequiredNullableStringProp;} - set - { - _RequiredNullableStringProp = value; - _flagRequiredNullableStringProp = true; - } - } - private string _RequiredNullableStringProp; - private bool _flagRequiredNullableStringProp; - - /// - /// Returns false as RequiredNullableStringProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableStringProp() - { - return _flagRequiredNullableStringProp; - } - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp - { - get{ return _RequiredNotnullableStringProp;} - set - { - _RequiredNotnullableStringProp = value; - _flagRequiredNotnullableStringProp = true; - } - } - private string _RequiredNotnullableStringProp; - private bool _flagRequiredNotnullableStringProp; - - /// - /// Returns false as RequiredNotnullableStringProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableStringProp() - { - return _flagRequiredNotnullableStringProp; - } - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp - { - get{ return _NotrequiredNullableStringProp;} - set - { - _NotrequiredNullableStringProp = value; - _flagNotrequiredNullableStringProp = true; - } - } - private string _NotrequiredNullableStringProp; - private bool _flagNotrequiredNullableStringProp; - - /// - /// Returns false as NotrequiredNullableStringProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableStringProp() - { - return _flagNotrequiredNullableStringProp; - } - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp - { - get{ return _NotrequiredNotnullableStringProp;} - set - { - _NotrequiredNotnullableStringProp = value; - _flagNotrequiredNotnullableStringProp = true; - } - } - private string _NotrequiredNotnullableStringProp; - private bool _flagNotrequiredNotnullableStringProp; - - /// - /// Returns false as NotrequiredNotnullableStringProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableStringProp() - { - return _flagNotrequiredNotnullableStringProp; - } - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp - { - get{ return _RequiredNullableBooleanProp;} - set - { - _RequiredNullableBooleanProp = value; - _flagRequiredNullableBooleanProp = true; - } - } - private bool? _RequiredNullableBooleanProp; - private bool _flagRequiredNullableBooleanProp; - - /// - /// Returns false as RequiredNullableBooleanProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableBooleanProp() - { - return _flagRequiredNullableBooleanProp; - } - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp - { - get{ return _RequiredNotnullableBooleanProp;} - set - { - _RequiredNotnullableBooleanProp = value; - _flagRequiredNotnullableBooleanProp = true; - } - } - private bool _RequiredNotnullableBooleanProp; - private bool _flagRequiredNotnullableBooleanProp; - - /// - /// Returns false as RequiredNotnullableBooleanProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableBooleanProp() - { - return _flagRequiredNotnullableBooleanProp; - } - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp - { - get{ return _NotrequiredNullableBooleanProp;} - set - { - _NotrequiredNullableBooleanProp = value; - _flagNotrequiredNullableBooleanProp = true; - } - } - private bool? _NotrequiredNullableBooleanProp; - private bool _flagNotrequiredNullableBooleanProp; - - /// - /// Returns false as NotrequiredNullableBooleanProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableBooleanProp() - { - return _flagNotrequiredNullableBooleanProp; - } - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp - { - get{ return _NotrequiredNotnullableBooleanProp;} - set - { - _NotrequiredNotnullableBooleanProp = value; - _flagNotrequiredNotnullableBooleanProp = true; - } - } - private bool _NotrequiredNotnullableBooleanProp; - private bool _flagNotrequiredNotnullableBooleanProp; - - /// - /// Returns false as NotrequiredNotnullableBooleanProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableBooleanProp() - { - return _flagNotrequiredNotnullableBooleanProp; - } - /// - /// Gets or Sets RequiredNullableDateProp - /// - [JsonConverter(typeof(OpenAPIDateConverter))] - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDateProp - { - get{ return _RequiredNullableDateProp;} - set - { - _RequiredNullableDateProp = value; - _flagRequiredNullableDateProp = true; - } - } - private DateTime? _RequiredNullableDateProp; - private bool _flagRequiredNullableDateProp; - - /// - /// Returns false as RequiredNullableDateProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableDateProp() - { - return _flagRequiredNullableDateProp; - } - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [JsonConverter(typeof(OpenAPIDateConverter))] - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotNullableDateProp - { - get{ return _RequiredNotNullableDateProp;} - set - { - _RequiredNotNullableDateProp = value; - _flagRequiredNotNullableDateProp = true; - } - } - private DateTime _RequiredNotNullableDateProp; - private bool _flagRequiredNotNullableDateProp; - - /// - /// Returns false as RequiredNotNullableDateProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotNullableDateProp() - { - return _flagRequiredNotNullableDateProp; - } - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [JsonConverter(typeof(OpenAPIDateConverter))] - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - public DateTime? NotRequiredNullableDateProp - { - get{ return _NotRequiredNullableDateProp;} - set - { - _NotRequiredNullableDateProp = value; - _flagNotRequiredNullableDateProp = true; - } - } - private DateTime? _NotRequiredNullableDateProp; - private bool _flagNotRequiredNullableDateProp; - - /// - /// Returns false as NotRequiredNullableDateProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotRequiredNullableDateProp() - { - return _flagNotRequiredNullableDateProp; - } - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [JsonConverter(typeof(OpenAPIDateConverter))] - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - public DateTime NotRequiredNotnullableDateProp - { - get{ return _NotRequiredNotnullableDateProp;} - set - { - _NotRequiredNotnullableDateProp = value; - _flagNotRequiredNotnullableDateProp = true; - } - } - private DateTime _NotRequiredNotnullableDateProp; - private bool _flagNotRequiredNotnullableDateProp; - - /// - /// Returns false as NotRequiredNotnullableDateProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotRequiredNotnullableDateProp() - { - return _flagNotRequiredNotnullableDateProp; - } - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp - { - get{ return _RequiredNotnullableDatetimeProp;} - set - { - _RequiredNotnullableDatetimeProp = value; - _flagRequiredNotnullableDatetimeProp = true; - } - } - private DateTime _RequiredNotnullableDatetimeProp; - private bool _flagRequiredNotnullableDatetimeProp; - - /// - /// Returns false as RequiredNotnullableDatetimeProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableDatetimeProp() - { - return _flagRequiredNotnullableDatetimeProp; - } - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp - { - get{ return _RequiredNullableDatetimeProp;} - set - { - _RequiredNullableDatetimeProp = value; - _flagRequiredNullableDatetimeProp = true; - } - } - private DateTime? _RequiredNullableDatetimeProp; - private bool _flagRequiredNullableDatetimeProp; - - /// - /// Returns false as RequiredNullableDatetimeProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableDatetimeProp() - { - return _flagRequiredNullableDatetimeProp; - } - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp - { - get{ return _NotrequiredNullableDatetimeProp;} - set - { - _NotrequiredNullableDatetimeProp = value; - _flagNotrequiredNullableDatetimeProp = true; - } - } - private DateTime? _NotrequiredNullableDatetimeProp; - private bool _flagNotrequiredNullableDatetimeProp; - - /// - /// Returns false as NotrequiredNullableDatetimeProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableDatetimeProp() - { - return _flagNotrequiredNullableDatetimeProp; - } - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp - { - get{ return _NotrequiredNotnullableDatetimeProp;} - set - { - _NotrequiredNotnullableDatetimeProp = value; - _flagNotrequiredNotnullableDatetimeProp = true; - } - } - private DateTime _NotrequiredNotnullableDatetimeProp; - private bool _flagNotrequiredNotnullableDatetimeProp; - - /// - /// Returns false as NotrequiredNotnullableDatetimeProp should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableDatetimeProp() - { - return _flagNotrequiredNotnullableDatetimeProp; - } - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid - { - get{ return _RequiredNullableUuid;} - set - { - _RequiredNullableUuid = value; - _flagRequiredNullableUuid = true; - } - } - private Guid? _RequiredNullableUuid; - private bool _flagRequiredNullableUuid; - - /// - /// Returns false as RequiredNullableUuid should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableUuid() - { - return _flagRequiredNullableUuid; - } - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid - { - get{ return _RequiredNotnullableUuid;} - set - { - _RequiredNotnullableUuid = value; - _flagRequiredNotnullableUuid = true; - } - } - private Guid _RequiredNotnullableUuid; - private bool _flagRequiredNotnullableUuid; - - /// - /// Returns false as RequiredNotnullableUuid should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableUuid() - { - return _flagRequiredNotnullableUuid; - } - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid - { - get{ return _NotrequiredNullableUuid;} - set - { - _NotrequiredNullableUuid = value; - _flagNotrequiredNullableUuid = true; - } - } - private Guid? _NotrequiredNullableUuid; - private bool _flagNotrequiredNullableUuid; - - /// - /// Returns false as NotrequiredNullableUuid should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableUuid() - { - return _flagNotrequiredNullableUuid; - } - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid - { - get{ return _NotrequiredNotnullableUuid;} - set - { - _NotrequiredNotnullableUuid = value; - _flagNotrequiredNotnullableUuid = true; - } - } - private Guid _NotrequiredNotnullableUuid; - private bool _flagNotrequiredNotnullableUuid; - - /// - /// Returns false as NotrequiredNotnullableUuid should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableUuid() - { - return _flagNotrequiredNotnullableUuid; - } - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString - { - get{ return _RequiredNullableArrayOfString;} - set - { - _RequiredNullableArrayOfString = value; - _flagRequiredNullableArrayOfString = true; - } - } - private List _RequiredNullableArrayOfString; - private bool _flagRequiredNullableArrayOfString; - - /// - /// Returns false as RequiredNullableArrayOfString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNullableArrayOfString() - { - return _flagRequiredNullableArrayOfString; - } - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString - { - get{ return _RequiredNotnullableArrayOfString;} - set - { - _RequiredNotnullableArrayOfString = value; - _flagRequiredNotnullableArrayOfString = true; - } - } - private List _RequiredNotnullableArrayOfString; - private bool _flagRequiredNotnullableArrayOfString; - - /// - /// Returns false as RequiredNotnullableArrayOfString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeRequiredNotnullableArrayOfString() - { - return _flagRequiredNotnullableArrayOfString; - } - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString - { - get{ return _NotrequiredNullableArrayOfString;} - set - { - _NotrequiredNullableArrayOfString = value; - _flagNotrequiredNullableArrayOfString = true; - } - } - private List _NotrequiredNullableArrayOfString; - private bool _flagNotrequiredNullableArrayOfString; - - /// - /// Returns false as NotrequiredNullableArrayOfString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNullableArrayOfString() - { - return _flagNotrequiredNullableArrayOfString; - } - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString - { - get{ return _NotrequiredNotnullableArrayOfString;} - set - { - _NotrequiredNotnullableArrayOfString = value; - _flagNotrequiredNotnullableArrayOfString = true; - } - } - private List _NotrequiredNotnullableArrayOfString; - private bool _flagNotrequiredNotnullableArrayOfString; - - /// - /// Returns false as NotrequiredNotnullableArrayOfString should not be serialized given that it's read-only. - /// - /// false (boolean) - public bool ShouldSerializeNotrequiredNotnullableArrayOfString() - { - return _flagNotrequiredNotnullableArrayOfString; - } - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs index 81c7a53956c6..4e25bc4a95cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs @@ -51,7 +51,7 @@ public SerializationTests() [TestMethod] public void Category() { - Category category = new("test", 1); + Category category = new(1, "test"); string categoryJson = JsonSerializer.Serialize(category, _jsonSerializerOptions); Category? category2 = JsonSerializer.Deserialize(categoryJson, _jsonSerializerOptions); Assert.AreEqual(category.Id, category2?.Id); @@ -101,14 +101,17 @@ public void GmFruit() string gmFruitJson = JsonSerializer.Serialize(gmFruit, _jsonSerializerOptions); GmFruit? gmFruit2 = JsonSerializer.Deserialize(gmFruitJson, _jsonSerializerOptions); Assert.IsTrue( - gmFruit.Apple.Value != null && - gmFruit.Banana.Value != null && + gmFruit.Apple != null && + gmFruit.Banana != null && gmFruit2 != null && - gmFruit2.Apple.Value != null && - gmFruit2.Banana.Value != null && - gmFruit2.Apple.Value.Cultivar.Equals(gmFruit.Apple.Value.Cultivar) && - gmFruit2.Apple.Value.Origin.Equals(gmFruit.Apple.Value.Origin) && - gmFruit2.Banana.Value.LengthCm.Equals(gmFruit.Banana.Value.LengthCm)); + gmFruit2.Apple != null && + gmFruit2.Banana != null && + gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && + gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && + gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); + + Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); + Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs index 9bf06b341412..1dc4e1bcbd06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs @@ -87,14 +87,17 @@ public void GmFruit() string gmFruitJson = JsonSerializer.Serialize(gmFruit, _jsonSerializerOptions); GmFruit? gmFruit2 = JsonSerializer.Deserialize(gmFruitJson, _jsonSerializerOptions); Assert.IsTrue( - gmFruit.Apple.Value != null && - gmFruit.Banana.Value != null && + gmFruit.Apple != null && + gmFruit.Banana != null && gmFruit2 != null && - gmFruit2.Apple.Value != null && - gmFruit2.Banana.Value != null && - gmFruit2.Apple.Value.Cultivar.Equals(gmFruit.Apple.Value.Cultivar) && - gmFruit2.Apple.Value.Origin.Equals(gmFruit.Apple.Value.Origin) && - gmFruit2.Banana.Value.LengthCm.Equals(gmFruit.Banana.Value.LengthCm)); + gmFruit2.Apple != null && + gmFruit2.Banana != null && + gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && + gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && + gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); + + Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); + Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES index 96f2ef1bc1c6..03f61d173609 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES @@ -79,7 +79,6 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md -docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -207,7 +206,6 @@ src/UseSourceGeneration/Model/PolymorphicProperty.cs src/UseSourceGeneration/Model/Quadrilateral.cs src/UseSourceGeneration/Model/QuadrilateralInterface.cs src/UseSourceGeneration/Model/ReadOnlyFirst.cs -src/UseSourceGeneration/Model/RequiredClass.cs src/UseSourceGeneration/Model/Return.cs src/UseSourceGeneration/Model/RolesReportsHash.cs src/UseSourceGeneration/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md index 5127709c28f2..cebefe7ff377 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md index f598aab71491..49836874e08f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md index 98fa755fce04..33be89a5331b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md @@ -4,11 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | -**Number** | **decimal** | | -**Password** | **string** | | -**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -16,6 +14,8 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] +**Number** | **decimal** | | +**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md index ea37536068af..0c5ac31d7992 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | -**PhotoUrls** | **List<string>** | | **Category** | [**Category**](Category.md) | | [optional] **Id** | **long** | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md deleted file mode 100644 index 0051888c2aed..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# UseSourceGeneration.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNotNullableDateProp** | **DateTime** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNotnullableEnumInteger** | **int** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**RequiredNotnullableEnumString** | **string** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableStringProp** | **string** | | -**RequiredNotnullableUuid** | **Guid** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNullableBooleanProp** | **bool** | | -**RequiredNullableDateProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime** | | -**RequiredNullableEnumInteger** | **int** | | -**RequiredNullableEnumIntegerOnly** | **int** | | -**RequiredNullableEnumString** | **string** | | -**RequiredNullableIntegerProp** | **int** | | -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNullableStringProp** | **string** | | -**RequiredNullableUuid** | **Guid** | | -**NotRequiredNullableDateProp** | **DateTime** | | [optional] -**NotRequiredNullableIntegerProp** | **int** | | [optional] -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNullableBooleanProp** | **bool** | | [optional] -**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNullableEnumInteger** | **int** | | [optional] -**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNullableUuid** | **Guid** | | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs index aff5eb0b28de..e36737349b7b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Api/FakeApiTests.cs @@ -219,16 +219,6 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } - /// - /// Test TestInlineFreeformAdditionalProperties - /// - [Fact (Skip = "not implemented")] - public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() - { - TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; - await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); - } - /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs index a30a809a237f..0a70d3d2f3a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs index a2ab283fc459..4935820c78d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/EnumTestTests.cs @@ -53,15 +53,6 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'EnumInteger' /// @@ -98,6 +89,15 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs index dda0523439cc..3c21562aaf1d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/FormatTestTests.cs @@ -54,48 +54,30 @@ public void FormatTestInstanceTest() } /// - /// Test the property 'VarByte' - /// - [Fact] - public void VarByteTest() - { - // TODO unit test for the property 'VarByte' - } - - /// - /// Test the property 'Date' - /// - [Fact] - public void DateTest() - { - // TODO unit test for the property 'Date' - } - - /// - /// Test the property 'Number' + /// Test the property 'Binary' /// [Fact] - public void NumberTest() + public void BinaryTest() { - // TODO unit test for the property 'Number' + // TODO unit test for the property 'Binary' } /// - /// Test the property 'Password' + /// Test the property 'VarByte' /// [Fact] - public void PasswordTest() + public void VarByteTest() { - // TODO unit test for the property 'Password' + // TODO unit test for the property 'VarByte' } /// - /// Test the property 'Binary' + /// Test the property 'Date' /// [Fact] - public void BinaryTest() + public void DateTest() { - // TODO unit test for the property 'Binary' + // TODO unit test for the property 'Date' } /// @@ -161,6 +143,24 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs index 24f0472ce352..750f806d61d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 535d720a770d..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,452 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using UseSourceGeneration.Model; -using UseSourceGeneration.Client; -using System.Reflection; - -namespace UseSourceGeneration.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs index f4eb80997ea9..ed4c7f582c69 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs @@ -143,8 +143,6 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -153,6 +151,8 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -169,30 +169,6 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) - return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) - return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) - return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) - return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) - return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) - return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs index a1bc8ed12897..7a8056ab4da0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs @@ -116,7 +116,6 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); - _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); @@ -211,7 +210,6 @@ public HostConfiguration(IServiceCollection services) new QuadrilateralSerializationContext(), new QuadrilateralInterfaceSerializationContext(), new ReadOnlyFirstSerializationContext(), - new RequiredClassSerializationContext(), new ReturnSerializationContext(), new RolesReportsHashSerializationContext(), new RolesReportsHashRoleSerializationContext(), diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs index c713a0416b9f..93f54baec74c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs @@ -37,17 +37,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index 70c2219671fa..21b946eba142 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -37,7 +37,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Option>> activityOutputs = default) + public Activity(Dictionary> activityOutputs) { ActivityOutputs = activityOutputs; OnCreated(); @@ -49,7 +49,7 @@ public Activity(Option [JsonPropertyName("activity_outputs")] - public Option>> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> activityOutputs = default; + Dictionary>? activityOutputs = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -131,12 +131,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs.Value == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + if (activityOutputs == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); - Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); - - return new Activity(activityOutputsParsedValue); + return new Activity(activityOutputs); } /// @@ -163,12 +161,8 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - if (activity.ActivityOutputs.Value == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - - if (activity.ActivityOutputs.IsSet) - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index 46c022562e19..7d7042c48e51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -38,7 +38,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + public ActivityOutputElementRepresentation(string prop1, Object prop2) { Prop1 = prop1; Prop2 = prop2; @@ -51,13 +51,13 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public Option Prop1 { get; set; } + public string Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Option Prop2 { get; set; } + public Object Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option prop1 = default; - Option prop2 = default; + string? prop1 = default; + Object? prop2 = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = new Option(utf8JsonReader.GetString()!); + prop1 = utf8JsonReader.GetString(); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -144,16 +144,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1.Value == null) - throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop1 == null) + throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); - if (prop2.Value == null) - throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop2 == null) + throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); - Option prop1ParsedValue = new Option(prop1.Value); - Option prop2ParsedValue = new Option(prop2.Value); - - return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -180,16 +177,9 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - if (activityOutputElementRepresentation.Prop1.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop2.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index ccf9531a5371..09b3dd1d2611 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -44,7 +44,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -64,49 +64,49 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Option EmptyMap { get; set; } + public Object EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Option>> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Option> MapProperty { get; set; } + public Dictionary MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Option> MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Option Anytype1 { get; set; } + public Object? Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -168,14 +168,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option emptyMap = default; - Option>?> mapOfMapProperty = default; - Option?> mapProperty = default; - Option mapWithUndeclaredPropertiesAnytype1 = default; - Option mapWithUndeclaredPropertiesAnytype2 = default; - Option?> mapWithUndeclaredPropertiesAnytype3 = default; - Option?> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; + Object? emptyMap = default; + Dictionary>? mapOfMapProperty = default; + Dictionary? mapProperty = default; + Object? mapWithUndeclaredPropertiesAnytype1 = default; + Object? mapWithUndeclaredPropertiesAnytype2 = default; + Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; + Dictionary? mapWithUndeclaredPropertiesString = default; + Object? anytype1 = default; while (utf8JsonReader.Read()) { @@ -194,35 +194,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -230,36 +230,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap.Value == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + if (emptyMap == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); - if (mapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapOfMapProperty == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapProperty.Value == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapProperty == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - Option emptyMapParsedValue = new Option(emptyMap.Value); - Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); - Option> mapPropertyParsedValue = new Option>(mapProperty.Value); - Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); - Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); - Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); - Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); - - return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -286,56 +278,22 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (additionalPropertiesClass.EmptyMap.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.EmptyMap.IsSet) - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapProperty.IsSet) - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapProperty.IsSet) - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1.IsSet) - if (additionalPropertiesClass.Anytype1.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index e0a273d1cacb..6beaaf3e97ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -38,7 +38,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, Option color = default) + public Animal(string className, string color = @"red") { ClassName = className; Color = color; @@ -57,7 +57,7 @@ public Animal(string className, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -123,8 +123,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option color = default; + string? className = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -142,10 +142,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -153,19 +153,13 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Animal.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - - string classNameParsedValue = className.Value; - Option colorParsedValue = new Option(color.Value); - - return new Animal(classNameParsedValue, colorParsedValue); + return new Animal(className, color); } /// @@ -192,14 +186,8 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - if (animal.ClassName == null) - throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); - - if (animal.Color.Value == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - - writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value); + writer.WriteString("className", animal.ClassName); + writer.WriteString("color", animal.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index 07455ca4be06..44f22494b301 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -39,7 +39,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(Option code = default, Option message = default, Option type = default) + public ApiResponse(int code, string message, string type) { Code = code; Message = message; @@ -53,19 +53,19 @@ public ApiResponse(Option code = default, Option message = default, /// Gets or Sets Code /// [JsonPropertyName("code")] - public Option Code { get; set; } + public int Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public Option Message { get; set; } + public string Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public string Type { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option code = default; - Option message = default; - Option type = default; + int? code = default; + string? message = default; + string? type = default; while (utf8JsonReader.Read()) { @@ -143,13 +143,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = utf8JsonReader.GetInt32(); break; case "message": - message = new Option(utf8JsonReader.GetString()!); + message = utf8JsonReader.GetString(); break; case "type": - type = new Option(utf8JsonReader.GetString()!); + type = utf8JsonReader.GetString(); break; default: break; @@ -157,20 +157,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code.Value == null) - throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + if (code == null) + throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); - if (message.Value == null) - throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + if (message == null) + throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); - Option codeParsedValue = new Option(code.Value.Value); - Option messageParsedValue = new Option(message.Value); - Option typeParsedValue = new Option(type.Value); - - return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); + return new ApiResponse(code.Value, message, type); } /// @@ -197,16 +193,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - if (apiResponse.Message.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); - - if (apiResponse.Type.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value); + writer.WriteNumber("code", apiResponse.Code); + writer.WriteString("message", apiResponse.Message); + writer.WriteString("type", apiResponse.Type); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index fdf5ad68de22..f163ab1d0ba5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -39,7 +39,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + public Apple(string colorCode, string cultivar, string origin) { ColorCode = colorCode; Cultivar = cultivar; @@ -53,19 +53,19 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public Option ColorCode { get; set; } + public string ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public Option Cultivar { get; set; } + public string Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public Option Origin { get; set; } + public string Origin { get; set; } /// /// Gets or Sets additional properties @@ -96,28 +96,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode.Value != null) { + if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode.Value).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar.Value != null) { + if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar.Value).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin.Value != null) { + if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin.Value).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -149,9 +149,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option colorCode = default; - Option cultivar = default; - Option origin = default; + string? colorCode = default; + string? cultivar = default; + string? origin = default; while (utf8JsonReader.Read()) { @@ -169,13 +169,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = new Option(utf8JsonReader.GetString()!); + colorCode = utf8JsonReader.GetString(); break; case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()!); + cultivar = utf8JsonReader.GetString(); break; case "origin": - origin = new Option(utf8JsonReader.GetString()!); + origin = utf8JsonReader.GetString(); break; default: break; @@ -183,20 +183,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode.Value == null) - throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + if (colorCode == null) + throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); - if (origin.Value == null) - throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + if (origin == null) + throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); - Option colorCodeParsedValue = new Option(colorCode.Value); - Option cultivarParsedValue = new Option(cultivar.Value); - Option originParsedValue = new Option(origin.Value); - - return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); + return new Apple(colorCode, cultivar, origin); } /// @@ -223,19 +219,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.ColorCode.Value == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); - - if (apple.Cultivar.Value == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); - - if (apple.Origin.Value == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value); + writer.WriteString("color_code", apple.ColorCode); + writer.WriteString("cultivar", apple.Cultivar); + writer.WriteString("origin", apple.Origin); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index d4d769dffb38..52d9af2f3611 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -38,7 +38,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, Option mealy = default) + public AppleReq(string cultivar, bool mealy) { Cultivar = cultivar; Mealy = mealy; @@ -57,7 +57,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public Option Mealy { get; set; } + public bool Mealy { get; set; } /// /// Returns the string presentation of the object @@ -106,8 +106,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option cultivar = default; - Option mealy = default; + string? cultivar = default; + bool? mealy = default; while (utf8JsonReader.Read()) { @@ -125,11 +125,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()!); + cultivar = utf8JsonReader.GetString(); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = utf8JsonReader.GetBoolean(); break; default: break; @@ -137,19 +137,13 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!cultivar.IsSet) - throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + if (mealy == null) + throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); - if (mealy.Value == null) - throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - - string cultivarParsedValue = cultivar.Value; - Option mealyParsedValue = new Option(mealy.Value.Value); - - return new AppleReq(cultivarParsedValue, mealyParsedValue); + return new AppleReq(cultivar, mealy.Value); } /// @@ -176,11 +170,8 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - if (appleReq.Cultivar == null) - throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - - writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) - writer.WriteBoolean("mealy", appleReq.Mealy.Value); + writer.WriteString("cultivar", appleReq.Cultivar); + writer.WriteBoolean("mealy", appleReq.Mealy); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index 2b7ca367ca02..96905a9ad00d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -37,7 +37,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -49,7 +49,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public Option>> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> arrayArrayNumber = default; + List>? arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -131,12 +131,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); - - return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -163,12 +161,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 283f9b8a2c68..2fc3f9aa15b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -37,7 +37,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(Option> arrayNumber = default) + public ArrayOfNumberOnly(List arrayNumber) { ArrayNumber = arrayNumber; OnCreated(); @@ -49,7 +49,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public Option> ArrayNumber { get; set; } + public List ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayNumber = default; + List? arrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -131,12 +131,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + if (arrayNumber == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); - Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); - - return new ArrayOfNumberOnly(arrayNumberParsedValue); + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -163,12 +161,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfNumberOnly.ArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - - if (arrayOfNumberOnly.ArrayNumber.IsSet) - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 7ca654eb7c2e..5923398e2cac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -39,7 +39,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -53,19 +53,19 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public Option>> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public Option>> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public Option> ArrayOfString { get; set; } + public List ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> arrayArrayOfInteger = default; - Option>?> arrayArrayOfModel = default; - Option?> arrayOfString = default; + List>? arrayArrayOfInteger = default; + List>? arrayArrayOfModel = default; + List? arrayOfString = default; while (utf8JsonReader.Read()) { @@ -143,15 +143,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -159,20 +159,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); - if (arrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); - if (arrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + if (arrayOfString == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); - Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); - Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); - Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); - - return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -199,24 +195,12 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - if (arrayTest.ArrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfInteger.IsSet) - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModel.IsSet) - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfString.IsSet) - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs index dd74c782e30b..5528e531ea89 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs @@ -37,7 +37,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(Option lengthCm = default) + public Banana(decimal lengthCm) { LengthCm = lengthCm; OnCreated(); @@ -49,7 +49,7 @@ public Banana(Option lengthCm = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public Option LengthCm { get; set; } + public decimal LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; + decimal? lengthCm = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; default: break; @@ -131,12 +131,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); - Option lengthCmParsedValue = new Option(lengthCm.Value.Value); - - return new Banana(lengthCmParsedValue); + return new Banana(lengthCm.Value); } /// @@ -163,8 +161,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.LengthCm.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCm.Value); + writer.WriteNumber("lengthCm", banana.LengthCm); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index b66e742c21b7..7b5186114050 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -38,7 +38,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, Option sweet = default) + public BananaReq(decimal lengthCm, bool sweet) { LengthCm = lengthCm; Sweet = sweet; @@ -57,7 +57,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public Option Sweet { get; set; } + public bool Sweet { get; set; } /// /// Returns the string presentation of the object @@ -106,8 +106,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; - Option sweet = default; + decimal? lengthCm = default; + bool? sweet = default; while (utf8JsonReader.Read()) { @@ -126,11 +126,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = utf8JsonReader.GetBoolean(); break; default: break; @@ -138,19 +138,13 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!lengthCm.IsSet) - throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + if (sweet == null) + throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); - if (sweet.Value == null) - throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - - decimal lengthCmParsedValue = lengthCm.Value.Value; - Option sweetParsedValue = new Option(sweet.Value.Value); - - return new BananaReq(lengthCmParsedValue, sweetParsedValue); + return new BananaReq(lengthCm.Value, sweet.Value); } /// @@ -177,8 +171,8 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) - writer.WriteBoolean("sweet", bananaReq.Sweet.Value); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + writer.WriteBoolean("sweet", bananaReq.Sweet); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs index 55b363a7d128..4721383c8969 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs @@ -104,7 +104,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -130,15 +130,10 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - - string classNameParsedValue = className.Value; - - return new BasquePig(classNameParsedValue); + return new BasquePig(className); } /// @@ -165,9 +160,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - if (basquePig.ClassName == null) - throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index 3faac8c216b1..b0cc3ec0d597 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -42,7 +42,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -60,37 +60,37 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public Option ATT_NAME { get; set; } + public string ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public Option CapitalCamel { get; set; } + public string CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public Option CapitalSnake { get; set; } + public string CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public Option SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public Option SmallCamel { get; set; } + public string SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public Option SmallSnake { get; set; } + public string SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -150,12 +150,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option aTTNAME = default; - Option capitalCamel = default; - Option capitalSnake = default; - Option sCAETHFlowPoints = default; - Option smallCamel = default; - Option smallSnake = default; + string? aTTNAME = default; + string? capitalCamel = default; + string? capitalSnake = default; + string? sCAETHFlowPoints = default; + string? smallCamel = default; + string? smallSnake = default; while (utf8JsonReader.Read()) { @@ -173,22 +173,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = new Option(utf8JsonReader.GetString()!); + aTTNAME = utf8JsonReader.GetString(); break; case "CapitalCamel": - capitalCamel = new Option(utf8JsonReader.GetString()!); + capitalCamel = utf8JsonReader.GetString(); break; case "Capital_Snake": - capitalSnake = new Option(utf8JsonReader.GetString()!); + capitalSnake = utf8JsonReader.GetString(); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); + sCAETHFlowPoints = utf8JsonReader.GetString(); break; case "smallCamel": - smallCamel = new Option(utf8JsonReader.GetString()!); + smallCamel = utf8JsonReader.GetString(); break; case "small_Snake": - smallSnake = new Option(utf8JsonReader.GetString()!); + smallSnake = utf8JsonReader.GetString(); break; default: break; @@ -196,32 +196,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME.Value == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + if (aTTNAME == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); - if (capitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + if (capitalCamel == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); - if (capitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + if (capitalSnake == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); - if (sCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + if (sCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); - if (smallCamel.Value == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + if (smallCamel == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); - if (smallSnake.Value == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + if (smallSnake == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); - Option aTTNAMEParsedValue = new Option(aTTNAME.Value); - Option capitalCamelParsedValue = new Option(capitalCamel.Value); - Option capitalSnakeParsedValue = new Option(capitalSnake.Value); - Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); - Option smallCamelParsedValue = new Option(smallCamel.Value); - Option smallSnakeParsedValue = new Option(smallSnake.Value); - - return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -248,31 +241,12 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - if (capitalization.ATT_NAME.Value == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); - - if (capitalization.CapitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); - - if (capitalization.CapitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); - - if (capitalization.SCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); - - if (capitalization.SmallCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); - - if (capitalization.SmallSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value); + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + writer.WriteString("smallCamel", capitalization.SmallCamel); + writer.WriteString("small_Snake", capitalization.SmallSnake); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index 99943e2df5d8..9535772c5069 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -39,7 +39,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, bool declawed, string color = @"red") : base(className, color) { Declawed = declawed; OnCreated(); @@ -51,7 +51,7 @@ public Cat(string className, Option declawed = default, Option col /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public Option Declawed { get; set; } + public bool Declawed { get; set; } /// /// Returns the string presentation of the object @@ -90,9 +90,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option declawed = default; - Option color = default; + string? className = default; + bool? declawed = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -110,14 +110,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = utf8JsonReader.GetBoolean(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -125,23 +125,16 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Cat.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + if (declawed == null) + throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); - if (declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - - string classNameParsedValue = className.Value; - Option declawedParsedValue = new Option(declawed.Value.Value); - Option colorParsedValue = new Option(color.Value); - - return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); + return new Cat(className, declawed.Value, color); } /// @@ -168,15 +161,9 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - if (cat.ClassName == null) - throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); - - if (cat.Color.Value == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - - writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value); + writer.WriteString("className", cat.ClassName); + writer.WriteBoolean("declawed", cat.Declawed); + writer.WriteString("color", cat.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 97ba57b23949..1c1133055c7c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -35,29 +35,29 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(long id, string name = @"default-name") { - Name = name; Id = id; + Name = name; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Name + /// Gets or Sets Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long Id { get; set; } /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public Option Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -73,8 +73,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -113,8 +113,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option id = default; + long? id = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -131,12 +131,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); break; default: break; @@ -144,19 +144,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Category.", nameof(name)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - string nameParsedValue = name.Value; - Option idParsedValue = new Option(id.Value.Value); - - return new Category(nameParsedValue, idParsedValue); + return new Category(id.Value, name); } /// @@ -183,11 +177,8 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - - writer.WriteString("name", category.Name); if (category.Id.IsSet) - writer.WriteNumber("id", category.Id.Value); + writer.WriteNumber("id", category.Id); + writer.WriteString("name", category.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index 2bf8c1a95d4f..7a1c4d8042d5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -38,7 +38,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) + public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) { Name = name; PetType = petType; @@ -93,6 +93,7 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { + if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -103,13 +104,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new Option PetType { get; set; } + public new PetTypeEnum PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Returns the string presentation of the object @@ -149,8 +150,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option petType = default; + string? name = default; + ChildCat.PetTypeEnum? petType = default; while (utf8JsonReader.Read()) { @@ -168,12 +169,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - if (petTypeRawValue != null) - petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + petType = petTypeRawValue == null + ? null + : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); break; default: break; @@ -181,16 +183,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); - Option nameParsedValue = new Option(name.Value); - Option petTypeParsedValue = new Option(petType.Value.Value); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); - return new ChildCat(nameParsedValue, petTypeParsedValue); + return new ChildCat(name, petType.Value); } /// @@ -217,11 +216,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - if (childCat.Name.Value == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + writer.WriteString("name", childCat.Name); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index bf09fee0f873..af9e0c3d1c52 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -37,7 +37,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(Option varClass = default) + public ClassModel(string varClass) { VarClass = varClass; OnCreated(); @@ -49,7 +49,7 @@ public ClassModel(Option varClass = default) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; + string? varClass = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); - Option varClassParsedValue = new Option(varClass.Value); - - return new ClassModel(varClassParsedValue); + return new ClassModel(varClass); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - if (classModel.VarClass.Value == null) - throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); - - if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value); + writer.WriteString("_class", classModel.VarClass); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index c29c8456bf96..3d57316efa89 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -113,8 +113,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string? quadrilateralType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -143,22 +143,13 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new ComplexQuadrilateral(quadrilateralType, shapeType); } /// @@ -185,13 +176,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (complexQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); - - if (complexQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs index 24e9f0f5cd0a..8734f04bad7e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs @@ -104,7 +104,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -130,15 +130,10 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - - string classNameParsedValue = className.Value; - - return new DanishPig(classNameParsedValue); + return new DanishPig(className); } /// @@ -165,9 +160,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - if (danishPig.ClassName == null) - throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index 8587afc4783a..bd4801d771cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -37,7 +37,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(Option dateOnlyProperty = default) + public DateOnlyClass(DateTime dateOnlyProperty) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -50,7 +50,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public Option DateOnlyProperty { get; set; } + public DateTime DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -110,7 +110,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateOnlyProperty = default; + DateTime? dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +129,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -137,12 +137,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty.Value == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + if (dateOnlyProperty == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); - Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); - - return new DateOnlyClass(dateOnlyPropertyParsedValue); + return new DateOnlyClass(dateOnlyProperty.Value); } /// @@ -169,8 +167,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index fb16fd495ced..1783c3add71c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -37,7 +37,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(Option name = default) + public DeprecatedObject(string name) { Name = name; OnCreated(); @@ -49,7 +49,7 @@ public DeprecatedObject(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); - Option nameParsedValue = new Option(name.Value); - - return new DeprecatedObject(nameParsedValue); + return new DeprecatedObject(name); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - if (deprecatedObject.Name.Value == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); - - if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value); + writer.WriteString("name", deprecatedObject.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index 37ac175257b2..70beb60686ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -35,11 +35,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// className /// breed + /// className /// color (default to "red") [JsonConstructor] - public Dog(string className, Option breed = default, Option color = default) : base(className, color) + public Dog(string breed, string className, string color = @"red") : base(className, color) { Breed = breed; OnCreated(); @@ -51,7 +51,7 @@ public Dog(string className, Option breed = default, Option colo /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public Option Breed { get; set; } + public string Breed { get; set; } /// /// Returns the string presentation of the object @@ -90,9 +90,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option breed = default; - Option color = default; + string? breed = default; + string? className = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -109,14 +109,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "className": - className = new Option(utf8JsonReader.GetString()!); - break; case "breed": - breed = new Option(utf8JsonReader.GetString()!); + breed = utf8JsonReader.GetString(); + break; + case "className": + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -124,23 +124,16 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Dog.", nameof(className)); + if (breed == null) + throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (breed.Value == null) - throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - - string classNameParsedValue = className.Value; - Option breedParsedValue = new Option(breed.Value); - Option colorParsedValue = new Option(color.Value); - - return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); + return new Dog(breed, className, color); } /// @@ -167,18 +160,9 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - if (dog.ClassName == null) - throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); - - if (dog.Breed.Value == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); - - if (dog.Color.Value == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - - writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value); + writer.WriteString("breed", dog.Breed); + writer.WriteString("className", dog.ClassName); + writer.WriteString("color", dog.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index 45e2397b30b6..955f0571e1d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -40,7 +40,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -55,25 +55,25 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Option MainShape { get; set; } + public Shape MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public Option> Shapes { get; set; } + public List Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public Option NullableShape { get; set; } + public NullableShape? NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public Option ShapeOrNull { get; set; } + public ShapeOrNull? ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -142,10 +142,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option mainShape = default; - Option?> shapes = default; - Option nullableShape = default; - Option shapeOrNull = default; + Shape? mainShape = default; + List? shapes = default; + NullableShape? nullableShape = default; + ShapeOrNull? shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -164,19 +164,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -184,16 +184,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape.Value == null) - throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + if (mainShape == null) + throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); - if (shapes.Value == null) - throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + if (shapes == null) + throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); - Option mainShapeParsedValue = new Option(mainShape.Value); - Option> shapesParsedValue = new Option>(shapes.Value); - - return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -220,34 +217,14 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - if (drawing.MainShape.Value == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); - - if (drawing.Shapes.Value == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - - if (drawing.MainShape.IsSet) - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.Shapes.IsSet) - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShape.IsSet) - if (drawing.NullableShape.Value != null) - { - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - } - else - writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNull.IsSet) - if (drawing.ShapeOrNull.Value != null) - { - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); - } - else - writer.WriteNull("shapeOrNull"); + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index 7477523d599c..d6194ce8255f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -38,7 +38,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -104,6 +104,7 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { + if (value == ArrayEnumEnum.Fish) return "fish"; @@ -170,6 +171,7 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -183,13 +185,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public Option JustSymbol { get; set; } + public JustSymbolEnum JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public Option> ArrayEnum { get; set; } + public List ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -245,8 +247,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayEnum = default; - Option justSymbol = default; + List? arrayEnum = default; + EnumArrays.JustSymbolEnum? justSymbol = default; while (utf8JsonReader.Read()) { @@ -265,12 +267,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); - if (justSymbolRawValue != null) - justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + justSymbol = justSymbolRawValue == null + ? null + : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); break; default: break; @@ -278,16 +281,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum.Value == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - - if (justSymbol.Value == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + if (arrayEnum == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); - Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); - Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + if (justSymbol == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); - return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); + return new EnumArrays(arrayEnum, justSymbol.Value); } /// @@ -314,13 +314,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - if (enumArrays.ArrayEnum.Value == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - if (enumArrays.ArrayEnum.IsSet) - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index 9ff7fdbab6ed..c267bb49c12e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -35,23 +35,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString + /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) { - EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; + EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -61,162 +61,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Defines EnumInteger /// @@ -280,7 +124,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public Option EnumInteger { get; set; } + public EnumIntegerEnum EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -345,7 +189,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public Option EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -404,6 +248,7 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -417,7 +262,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public Option EnumNumber { get; set; } + public EnumNumberEnum EnumNumber { get; set; } /// /// Defines EnumString @@ -542,6 +387,7 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// public static string EnumStringEnumToJsonValue(EnumStringEnum value) { + if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -573,31 +419,188 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public Option EnumString { get; set; } + public EnumStringEnum EnumString { get; set; } + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public Option OuterEnumDefaultValue { get; set; } + public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public Option OuterEnumInteger { get; set; } + public OuterEnumInteger OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public Option OuterEnumIntegerDefaultValue { get; set; } + public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public Option OuterEnum { get; set; } + public OuterEnum? OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -613,11 +616,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -660,15 +663,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option enumStringRequired = default; - Option enumInteger = default; - Option enumIntegerOnly = default; - Option enumNumber = default; - Option enumString = default; - Option outerEnumDefaultValue = default; - Option outerEnumInteger = default; - Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; + EnumTest.EnumIntegerEnum? enumInteger = default; + EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; + EnumTest.EnumNumberEnum? enumNumber = default; + EnumTest.EnumStringEnum? enumString = default; + EnumTest.EnumStringRequiredEnum? enumStringRequired = default; + OuterEnumDefaultValue? outerEnumDefaultValue = default; + OuterEnumInteger? outerEnumInteger = default; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; + OuterEnum? outerEnum = default; while (utf8JsonReader.Read()) { @@ -685,47 +688,53 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - if (enumStringRequiredRawValue != null) - enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); - break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - if (enumStringRawValue != null) - enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + enumString = enumStringRawValue == null + ? null + : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); + break; + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + enumStringRequired = enumStringRequiredRawValue == null + ? null + : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumDefaultValueRawValue != null) - outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + outerEnumDefaultValue = outerEnumDefaultValueRawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerRawValue != null) - outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + outerEnumInteger = outerEnumIntegerRawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerDefaultValueRawValue != null) - outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + outerEnum = outerEnumRawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); break; default: break; @@ -733,43 +742,31 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!enumStringRequired.IsSet) - throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - - if (enumStringRequired.Value == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + if (enumInteger == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); - if (enumInteger.Value == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + if (enumIntegerOnly == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); - if (enumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + if (enumNumber == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); - if (enumNumber.Value == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + if (enumString == null) + throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); - if (enumString.Value == null) - throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + if (enumStringRequired == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (outerEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); - if (outerEnumInteger.Value == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + if (outerEnumInteger == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); - if (outerEnumIntegerDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumIntegerDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); - EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; - Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); - Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); - Option enumNumberParsedValue = new Option(enumNumber.Value.Value); - Option enumStringParsedValue = new Option(enumString.Value.Value); - Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); - Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); - Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); - - return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); + return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); } /// @@ -796,44 +793,44 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); + else + writer.WriteNull("enum_string"); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - if (enumTest.OuterEnumDefaultValue.IsSet) - { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + if (outerEnumDefaultValueRawValue != null) writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - } - if (enumTest.OuterEnumInteger.IsSet) - { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - } - if (enumTest.OuterEnumIntegerDefaultValue.IsSet) + else + writer.WriteNull("outerEnumDefaultValue"); + + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + + if (enumTest.OuterEnum == null) + writer.WriteNull("outerEnum"); + else { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); - } - if (enumTest.OuterEnum.IsSet) - if (enumTest.OuterEnum.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); + if (outerEnumRawValue != null) writer.WriteString("outerEnum", outerEnumRawValue); - } else writer.WriteNull("outerEnum"); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index e99f60cdbe60..b161cd58e182 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -113,8 +113,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -143,22 +143,13 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new EquilateralTriangle(shapeType, triangleType); } /// @@ -185,13 +176,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (equilateralTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); - - if (equilateralTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - - writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index f90379c69520..bc7f05fae9e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -37,7 +37,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(Option sourceURI = default) + public File(string sourceURI) { SourceURI = sourceURI; OnCreated(); @@ -50,7 +50,7 @@ public File(Option sourceURI = default) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public Option SourceURI { get; set; } + public string SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -105,7 +105,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option sourceURI = default; + string? sourceURI = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = new Option(utf8JsonReader.GetString()!); + sourceURI = utf8JsonReader.GetString(); break; default: break; @@ -131,12 +131,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI.Value == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + if (sourceURI == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); - Option sourceURIParsedValue = new Option(sourceURI.Value); - - return new File(sourceURIParsedValue); + return new File(sourceURI); } /// @@ -163,11 +161,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - if (file.SourceURI.Value == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); - - if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value); + writer.WriteString("sourceURI", file.SourceURI); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index b62dc9ed4968..68d2af61dbc1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -38,7 +38,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(Option file = default, Option> files = default) + public FileSchemaTestClass(File file, List files) { File = file; Files = files; @@ -51,13 +51,13 @@ public FileSchemaTestClass(Option file = default, Option> files /// Gets or Sets File /// [JsonPropertyName("file")] - public Option File { get; set; } + public File File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public Option> Files { get; set; } + public List Files { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option file = default; - Option?> files = default; + File? file = default; + List? files = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -145,16 +145,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file.Value == null) - throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + if (file == null) + throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); - if (files.Value == null) - throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + if (files == null) + throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); - Option fileParsedValue = new Option(file.Value); - Option> filesParsedValue = new Option>(files.Value); - - return new FileSchemaTestClass(fileParsedValue, filesParsedValue); + return new FileSchemaTestClass(file, files); } /// @@ -181,18 +178,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - if (fileSchemaTestClass.File.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.Files.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.File.IsSet) - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.Files.IsSet) - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index 2ee7a6584964..dbedd34f861d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -37,7 +37,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(Option bar = default) + public Foo(string bar = @"bar") { Bar = bar; OnCreated(); @@ -49,7 +49,7 @@ public Foo(Option bar = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; set; } + public string Bar { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; + string? bar = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); - Option barParsedValue = new Option(bar.Value); - - return new Foo(barParsedValue); + return new Foo(bar); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - if (foo.Bar.Value == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); - - if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value); + writer.WriteString("bar", foo.Bar); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index f9a519966634..dabc1bd83dbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -37,7 +37,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Option varString = default) + public FooGetDefaultResponse(Foo varString) { VarString = varString; OnCreated(); @@ -49,7 +49,7 @@ public FooGetDefaultResponse(Option varString = default) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public Foo VarString { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varString = default; + Foo? varString = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -131,12 +131,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); - Option varStringParsedValue = new Option(varString.Value); - - return new FooGetDefaultResponse(varStringParsedValue); + return new FooGetDefaultResponse(varString); } /// @@ -163,12 +161,8 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - if (fooGetDefaultResponse.VarString.Value == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - - if (fooGetDefaultResponse.VarString.IsSet) - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index cc6e5395a381..d45a83b0f1d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -35,11 +35,9 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// binary /// varByte /// date - /// number - /// password - /// binary /// dateTime /// varDecimal /// varDouble @@ -47,6 +45,8 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer + /// number + /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -55,13 +55,11 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) { + Binary = binary; VarByte = varByte; Date = date; - Number = number; - Password = password; - Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -69,6 +67,8 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password Int32 = int32; Int64 = int64; Integer = integer; + Number = number; + Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -81,6 +81,12 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password partial void OnCreated(); + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get; set; } + /// /// Gets or Sets VarByte /// @@ -94,112 +100,106 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password [JsonPropertyName("date")] public DateTime Date { get; set; } - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } - - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public Option Binary { get; set; } - /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public Option VarDecimal { get; set; } + public decimal VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public Option VarDouble { get; set; } + public double VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public Option VarFloat { get; set; } + public float VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public Option Int32 { get; set; } + public int Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public Option Int64 { get; set; } + public long Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public Option Integer { get; set; } + public int Integer { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public Option PatternWithBackslash { get; set; } + public string PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public Option PatternWithDigits { get; set; } + public string PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public Option PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public string VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public Option UnsignedInteger { get; set; } + public uint UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public Option UnsignedLong { get; set; } + public ulong UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets additional properties @@ -215,11 +215,9 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -227,6 +225,8 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -246,122 +246,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - // VarDouble (double) maximum - if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) + if (this.VarDouble > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) + if (this.VarDouble < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) + if (this.VarFloat > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) + if (this.VarFloat < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32.IsSet && this.Int32.Value > (int)200) + if (this.Int32 > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32.IsSet && this.Int32.Value < (int)20) + if (this.Int32 < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer.IsSet && this.Integer.Value > (int)100) + if (this.Integer > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer.IsSet && this.Integer.Value < (int)10) + if (this.Integer < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - if (this.PatternWithBackslash.Value != null) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits.Value != null) { + if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter.Value != null) { + if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString.Value != null) { + if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString.Value).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) + if (this.UnsignedInteger > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) + if (this.UnsignedInteger < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -402,25 +402,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varByte = default; - Option date = default; - Option number = default; - Option password = default; - Option binary = default; - Option dateTime = default; - Option varDecimal = default; - Option varDouble = default; - Option varFloat = default; - Option int32 = default; - Option int64 = default; - Option integer = default; - Option patternWithBackslash = default; - Option patternWithDigits = default; - Option patternWithDigitsAndDelimiter = default; - Option varString = default; - Option unsignedInteger = default; - Option unsignedLong = default; - Option uuid = default; + System.IO.Stream? binary = default; + byte[]? varByte = default; + DateTime? date = default; + DateTime? dateTime = default; + decimal? varDecimal = default; + double? varDouble = default; + float? varFloat = default; + int? int32 = default; + long? int64 = default; + int? integer = default; + decimal? number = default; + string? password = default; + string? patternWithBackslash = default; + string? patternWithDigits = default; + string? patternWithDigitsAndDelimiter = default; + string? varString = default; + uint? unsignedInteger = default; + ulong? unsignedLong = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -437,76 +437,76 @@ 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)!); - break; - case "date": + case "binary": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "number": + case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); - break; - case "password": - password = new Option(utf8JsonReader.GetString()!); + varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "binary": + case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + date = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = utf8JsonReader.GetDouble(); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = (float)utf8JsonReader.GetDouble(); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = utf8JsonReader.GetInt32(); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = utf8JsonReader.GetInt64(); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = utf8JsonReader.GetInt32(); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = utf8JsonReader.GetDecimal(); + break; + case "password": + password = utf8JsonReader.GetString(); break; case "pattern_with_backslash": - patternWithBackslash = new Option(utf8JsonReader.GetString()!); + patternWithBackslash = utf8JsonReader.GetString(); break; case "pattern_with_digits": - patternWithDigits = new Option(utf8JsonReader.GetString()!); + patternWithDigits = utf8JsonReader.GetString(); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); + patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); break; case "string": - varString = new Option(utf8JsonReader.GetString()!); + varString = utf8JsonReader.GetString(); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = utf8JsonReader.GetUInt32(); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = utf8JsonReader.GetUInt64(); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -514,96 +514,64 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (!varByte.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - - if (!date.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - - if (!number.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - - if (!password.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - - if (varByte.Value == null) - throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + if (binary == null) + throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - if (date.Value == null) - throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (number.Value == null) - throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + if (date == null) + throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); - if (binary.Value == null) - throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + if (varDecimal == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + if (varDouble == null) + throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); - if (varDecimal.Value == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); - if (varDouble.Value == null) - throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + if (int32 == null) + throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); - if (varFloat.Value == null) - throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + if (int64 == null) + throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); - if (int32.Value == null) - throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + if (integer == null) + throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); - if (int64.Value == null) - throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + if (number == null) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (integer.Value == null) - throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (patternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); - if (patternWithDigits.Value == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + if (patternWithDigits == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); - if (patternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + if (patternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); - if (unsignedInteger.Value == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + if (unsignedInteger == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); - if (unsignedLong.Value == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + if (unsignedLong == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); - byte[] varByteParsedValue = varByte.Value; - DateTime dateParsedValue = date.Value.Value; - decimal numberParsedValue = number.Value.Value; - string passwordParsedValue = password.Value; - Option binaryParsedValue = new Option(binary.Value); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option varDecimalParsedValue = new Option(varDecimal.Value.Value); - Option varDoubleParsedValue = new Option(varDouble.Value.Value); - Option varFloatParsedValue = new Option(varFloat.Value.Value); - Option int32ParsedValue = new Option(int32.Value.Value); - Option int64ParsedValue = new Option(int64.Value.Value); - Option integerParsedValue = new Option(integer.Value.Value); - Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); - Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); - Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); - Option varStringParsedValue = new Option(varString.Value); - Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); - Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - - return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); + return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); } /// @@ -630,49 +598,28 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.VarByte == null) - throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); - - if (formatTest.Password == null) - throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); - - if (formatTest.Binary.Value == null) - throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); - - if (formatTest.PatternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigits.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - - if (formatTest.VarString.Value == null) - throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); - + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); + writer.WriteNumber("float", formatTest.VarFloat); + writer.WriteNumber("int32", formatTest.Int32); + writer.WriteNumber("int64", formatTest.Int64); + writer.WriteNumber("integer", formatTest.Integer); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + writer.WriteString("string", formatTest.VarString); + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); + writer.WriteString("uuid", formatTest.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index 6e503a282d9e..be945563eba9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -37,7 +37,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color = default) + public Fruit(Apple apple, string color) { Apple = apple; Color = color; @@ -49,7 +49,7 @@ public Fruit(Apple apple, Option color = default) /// /// /// color - public Fruit(Banana banana, Option color = default) + public Fruit(Banana banana, string color) { Banana = banana; Color = color; @@ -72,7 +72,7 @@ public Fruit(Banana banana, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -120,7 +120,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -160,7 +160,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -168,16 +168,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - - Option colorParsedValue = new Option(color.Value); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); if (apple != null) - return new Fruit(apple, colorParsedValue); + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, colorParsedValue); + return new Fruit(banana, color); throw new JsonException(); } @@ -206,11 +204,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index ade243e645b3..fea0b966137f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -38,7 +38,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Option apple, Option banana, Option color = default) + public GmFruit(Apple? apple, Banana? banana, string color) { Apple = apple; Banana = banana; @@ -51,18 +51,18 @@ public GmFruit(Option apple, Option banana, Option colo /// /// Gets or Sets Apple /// - public Option Apple { get; set; } + public Apple? Apple { get; set; } /// /// Gets or Sets Banana /// - public Option Banana { get; set; } + public Banana? Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -110,7 +110,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -150,7 +150,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -158,15 +158,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); - Option colorParsedValue = new Option(color.Value); - - Option appleParsedValue = new Option(apple); - Option bananaParsedValue = new Option(banana); - - return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); + return new GmFruit(apple, banana, color); } /// @@ -180,16 +175,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) + if (gmFruit.Apple != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); } - if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) + if (gmFruit.Banana != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -205,11 +200,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - if (gmFruit.Color.Value == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); - - if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value); + writer.WriteString("color", gmFruit.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs index b80fee0e5b96..d4a0752699b2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs @@ -114,7 +114,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string? petType = default; while (utf8JsonReader.Read()) { @@ -132,7 +132,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()!); + petType = utf8JsonReader.GetString(); break; default: break; @@ -140,15 +140,10 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - - string petTypeParsedValue = petType.Value; - - return new GrandparentAnimal(petTypeParsedValue); + return new GrandparentAnimal(petType); } /// @@ -175,9 +170,6 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - if (grandparentAnimal.PetType == null) - throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index bc168e8d134b..0ba58633d833 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -38,7 +38,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(Option bar = default, Option foo = default) + internal HasOnlyReadOnly(string bar, string foo) { Bar = bar; Foo = foo; @@ -51,13 +51,13 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public Option Foo { get; } + public string Foo { get; } /// /// Gets or Sets additional properties @@ -150,8 +150,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option foo = default; + string? bar = default; + string? foo = default; while (utf8JsonReader.Read()) { @@ -169,10 +169,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; case "foo": - foo = new Option(utf8JsonReader.GetString()!); + foo = utf8JsonReader.GetString(); break; default: break; @@ -180,16 +180,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); - if (foo.Value == null) - throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + if (foo == null) + throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); - Option barParsedValue = new Option(bar.Value); - Option fooParsedValue = new Option(foo.Value); - - return new HasOnlyReadOnly(barParsedValue, fooParsedValue); + return new HasOnlyReadOnly(bar, foo); } /// @@ -216,15 +213,8 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - if (hasOnlyReadOnly.Bar.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Foo.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); + writer.WriteString("bar", hasOnlyReadOnly.Bar); + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs index 858556af56ea..b0753cea2a42 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs @@ -37,7 +37,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(Option nullableMessage = default) + public HealthCheckResult(string? nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -49,7 +49,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public Option NullableMessage { get; set; } + public string? NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option nullableMessage = default; + string? nullableMessage = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = new Option(utf8JsonReader.GetString()); + nullableMessage = utf8JsonReader.GetString(); break; default: break; @@ -157,11 +157,7 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - if (healthCheckResult.NullableMessage.IsSet) - if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); - else - writer.WriteNull("NullableMessage"); + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index cf075d50b529..e54fa76f0663 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -106,8 +106,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -125,10 +125,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -136,22 +136,13 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new IsoscelesTriangle(shapeType, triangleType); } /// @@ -178,13 +169,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (isoscelesTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); - - if (isoscelesTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index fccf11624a13..031e16c39a57 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -37,7 +37,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(Option var123List = default) + public List(string var123List) { Var123List = var123List; OnCreated(); @@ -49,7 +49,7 @@ public List(Option var123List = default) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public Option Var123List { get; set; } + public string Var123List { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option var123List = default; + string? var123List = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = new Option(utf8JsonReader.GetString()!); + var123List = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List.Value == null) - throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + if (var123List == null) + throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); - Option var123ListParsedValue = new Option(var123List.Value); - - return new List(var123ListParsedValue); + return new List(var123List); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - if (list.Var123List.Value == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); - - if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value); + writer.WriteString("123-list", list.Var123List); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 7255eff69394..46ae1dc05ae3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -38,7 +38,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -51,13 +51,13 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public Option EscapedLiteralString { get; set; } + public string EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public Option UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option escapedLiteralString = default; - Option unescapedLiteralString = default; + string? escapedLiteralString = default; + string? unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = new Option(utf8JsonReader.GetString()!); + escapedLiteralString = utf8JsonReader.GetString(); break; case "unescapedLiteralString": - unescapedLiteralString = new Option(utf8JsonReader.GetString()!); + unescapedLiteralString = utf8JsonReader.GetString(); break; default: break; @@ -143,16 +143,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); - if (unescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); - Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); - Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); - - return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -179,15 +176,8 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - if (literalStringClass.EscapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.UnescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs index 64a8e749fd03..fcc1424f2c19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs @@ -154,7 +154,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; Pig? pig = null; Whale? whale = null; @@ -211,7 +211,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -219,22 +219,17 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Mammal.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); if (pig != null) - return new Mammal(pig, classNameParsedValue); + return new Mammal(pig, className); if (whale != null) - return new Mammal(whale, classNameParsedValue); + return new Mammal(whale, className); if (zebra != null) - return new Mammal(zebra, classNameParsedValue); + return new Mammal(zebra, className); throw new JsonException(); } @@ -278,9 +273,6 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - if (mammal.ClassName == null) - throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index 9fbce04435cc..e3deeb54016f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -40,7 +40,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) { DirectMap = directMap; IndirectMap = indirectMap; @@ -108,6 +108,7 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { + if (value == InnerEnum.UPPER) return "UPPER"; @@ -121,25 +122,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Option> DirectMap { get; set; } + public Dictionary DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Option> IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Option>> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Option> MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -197,10 +198,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> directMap = default; - Option?> indirectMap = default; - Option>?> mapMapOfString = default; - Option?> mapOfEnumString = default; + Dictionary? directMap = default; + Dictionary? indirectMap = default; + Dictionary>? mapMapOfString = default; + Dictionary? mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -219,19 +220,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -239,24 +240,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap.Value == null) - throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - - if (indirectMap.Value == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + if (directMap == null) + throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); - if (mapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + if (indirectMap == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); - if (mapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + if (mapMapOfString == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); - Option> directMapParsedValue = new Option>(directMap.Value); - Option> indirectMapParsedValue = new Option>(indirectMap.Value); - Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); - Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + if (mapOfEnumString == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); - return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -283,30 +279,14 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - if (mapTest.DirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); - - if (mapTest.IndirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); - - if (mapTest.MapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); - - if (mapTest.MapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - - if (mapTest.DirectMap.IsSet) - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMap.IsSet) - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfString.IsSet) - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumString.IsSet) - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index f12e4cccbdcf..25ea1076cd59 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -40,7 +40,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) { DateTime = dateTime; Map = map; @@ -55,25 +55,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = d /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Option> Map { get; set; } + public Dictionary Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Option UuidWithPattern { get; set; } + public Guid UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -107,7 +107,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -142,10 +142,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateTime = default; - Option?> map = default; - Option uuid = default; - Option uuidWithPattern = default; + DateTime? dateTime = default; + Dictionary? map = default; + Guid? uuid = default; + Guid? uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -164,19 +164,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = utf8JsonReader.GetGuid(); break; default: break; @@ -184,24 +184,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map.Value == null) - throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map == null) + throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern.Value == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option> mapParsedValue = new Option>(map.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); - - return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); } /// @@ -228,16 +223,11 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index e6b2327c8929..74f7acb1e828 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -38,7 +38,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(Option varClass = default, Option name = default) + public Model200Response(string varClass, int name) { VarClass = varClass; Name = name; @@ -51,13 +51,13 @@ public Model200Response(Option varClass = default, Option name = de /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public int Name { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; - Option name = default; + string? varClass = default; + int? name = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = utf8JsonReader.GetString(); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = utf8JsonReader.GetInt32(); break; default: break; @@ -144,16 +144,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); - Option varClassParsedValue = new Option(varClass.Value); - Option nameParsedValue = new Option(name.Value.Value); - - return new Model200Response(varClassParsedValue, nameParsedValue); + return new Model200Response(varClass, name.Value); } /// @@ -180,12 +177,8 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - if (model200Response.VarClass.Value == null) - throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) - writer.WriteNumber("name", model200Response.Name.Value); + writer.WriteString("class", model200Response.VarClass); + writer.WriteNumber("name", model200Response.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index bc4bfe24c489..5bc60589f350 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -37,7 +37,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(Option varClient = default) + public ModelClient(string varClient) { VarClient = varClient; OnCreated(); @@ -49,7 +49,7 @@ public ModelClient(Option varClient = default) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public Option VarClient { get; set; } + public string VarClient { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClient = default; + string? varClient = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = new Option(utf8JsonReader.GetString()!); + varClient = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient.Value == null) - throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + if (varClient == null) + throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); - Option varClientParsedValue = new Option(varClient.Value); - - return new ModelClient(varClientParsedValue); + return new ModelClient(varClient); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - if (modelClient.VarClient.Value == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); - - if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value); + writer.WriteString("client", modelClient.VarClient); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 3751a4a7b237..4648cf04f7d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -40,7 +40,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + public Name(int varName, string property, int snakeCase, int var123Number) { VarName = varName; Property = property; @@ -61,19 +61,19 @@ public Name(int varName, Option property = default, Option snakeCas /// Gets or Sets Property /// [JsonPropertyName("property")] - public Option Property { get; set; } + public string Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public Option SnakeCase { get; } + public int SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public Option Var123Number { get; } + public int Var123Number { get; } /// /// Gets or Sets additional properties @@ -168,10 +168,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varName = default; - Option property = default; - Option snakeCase = default; - Option var123Number = default; + int? varName = default; + string? property = default; + int? snakeCase = default; + int? var123Number = default; while (utf8JsonReader.Read()) { @@ -190,18 +190,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = utf8JsonReader.GetInt32(); break; case "property": - property = new Option(utf8JsonReader.GetString()!); + property = utf8JsonReader.GetString(); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = utf8JsonReader.GetInt32(); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = utf8JsonReader.GetInt32(); break; default: break; @@ -209,27 +209,19 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!varName.IsSet) - throw new ArgumentException("Property is required for class Name.", nameof(varName)); + if (varName == null) + throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (varName.Value == null) - throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + if (property == null) + throw new ArgumentNullException(nameof(property), "Property is required for class Name."); - if (property.Value == null) - throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + if (snakeCase == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); - if (snakeCase.Value == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + if (var123Number == null) + throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); - if (var123Number.Value == null) - throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - - int varNameParsedValue = varName.Value.Value; - Option propertyParsedValue = new Option(property.Value); - Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); - Option var123NumberParsedValue = new Option(var123Number.Value.Value); - - return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); + return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); } /// @@ -256,13 +248,10 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - if (name.Property.Value == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - - writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) - writer.WriteNumber("123Number", name.Var123Number.Value); + writer.WriteNumber("name", name.VarName); + writer.WriteString("property", name.Property); + writer.WriteNumber("snake_case", name.SnakeCase); + writer.WriteNumber("123Number", name.Var123Number); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 3ddf16689181..ed43ab9fcd27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -113,8 +113,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> aObjVariableobject = default; - Option pkiNotificationtestID = default; + List>? aObjVariableobject = default; + int? pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = utf8JsonReader.GetInt32(); break; default: break; @@ -145,22 +145,13 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (!aObjVariableobject.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + if (aObjVariableobject == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (!pkiNotificationtestID.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + if (pkiNotificationtestID == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (aObjVariableobject.Value == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - if (pkiNotificationtestID.Value == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - List> aObjVariableobjectParsedValue = aObjVariableobject.Value; - int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; - - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); } /// @@ -187,9 +178,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { - if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) - throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 06ddb2cdcb1a..5374e7a890e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -48,7 +48,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -71,73 +71,73 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonPropertyName("array_items_nullable")] - public Option> ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Option> ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public Option?> ArrayAndItemsNullableProp { get; set; } + public List? ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public Option?> ArrayNullableProp { get; set; } + public List? ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public Option BooleanProp { get; set; } + public bool? BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public Option DateProp { get; set; } + public DateTime? DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public Option DatetimeProp { get; set; } + public DateTime? DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public Option IntegerProp { get; set; } + public int? IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public Option NumberProp { get; set; } + public decimal? NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Option?> ObjectAndItemsNullableProp { get; set; } + public Dictionary? ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Option?> ObjectNullableProp { get; set; } + public Dictionary? ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public Option StringProp { get; set; } + public string? StringProp { get; set; } /// /// Gets or Sets additional properties @@ -224,18 +224,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayItemsNullable = default; - Option?> objectItemsNullable = default; - Option?> arrayAndItemsNullableProp = default; - Option?> arrayNullableProp = default; - Option booleanProp = default; - Option dateProp = default; - Option datetimeProp = default; - Option integerProp = default; - Option numberProp = default; - Option?> objectAndItemsNullableProp = default; - Option?> objectNullableProp = default; - Option stringProp = default; + List? arrayItemsNullable = default; + Dictionary? objectItemsNullable = default; + List? arrayAndItemsNullableProp = default; + List? arrayNullableProp = default; + bool? booleanProp = default; + DateTime? dateProp = default; + DateTime? datetimeProp = default; + int? integerProp = default; + decimal? numberProp = default; + Dictionary? objectAndItemsNullableProp = default; + Dictionary? objectNullableProp = default; + string? stringProp = default; while (utf8JsonReader.Read()) { @@ -254,50 +254,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = utf8JsonReader.GetBoolean(); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = utf8JsonReader.GetInt32(); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = utf8JsonReader.GetDecimal(); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "string_prop": - stringProp = new Option(utf8JsonReader.GetString()); + stringProp = utf8JsonReader.GetString(); break; default: break; @@ -305,16 +305,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + if (arrayItemsNullable == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); - if (objectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + if (objectItemsNullable == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); - Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); - Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); - - return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -341,75 +338,45 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableClass.ArrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ObjectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ArrayItemsNullable.IsSet) - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullable.IsSet) - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullableProp.IsSet) - if (nullableClass.ArrayAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullableProp.IsSet) - if (nullableClass.ArrayNullableProp.Value != null) - { - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) - if (nullableClass.ObjectAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullableProp.IsSet) - if (nullableClass.ObjectNullableProp.Value != null) - { - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else - writer.WriteNull("string_prop"); + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + + if (nullableClass.BooleanProp != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DateProp != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimeProp != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerProp != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberProp != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); + else + writer.WriteNull("number_prop"); + + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs index d877f7e61019..eb5434dc5ba1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs @@ -37,7 +37,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Option uuid = default) + public NullableGuidClass(Guid? uuid = default) { Uuid = uuid; OnCreated(); @@ -50,7 +50,7 @@ public NullableGuidClass(Option uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid? Uuid { get; set; } /// /// Gets or Sets additional properties @@ -105,7 +105,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option uuid = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -124,7 +124,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -159,11 +159,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid.IsSet) - if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); - else - writer.WriteNull("uuid"); + + if (nullableGuidClass.Uuid == null) + writer.WriteNull("uuid"); + else + writer.WriteString("uuid", nullableGuidClass.Uuid.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs index 46927f581c3d..8a1f0995af65 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs @@ -137,7 +137,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -196,19 +196,14 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeTypeParsedValue); + return new NullableShape(quadrilateral, shapeType); if (triangle != null) - return new NullableShape(triangle, shapeTypeParsedValue); + return new NullableShape(triangle, shapeType); throw new JsonException(); } @@ -247,9 +242,6 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - if (nullableShape.ShapeType == null) - throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs index 71d5a3b8016b..740f496eb9d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs @@ -37,7 +37,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(Option justNumber = default) + public NumberOnly(decimal justNumber) { JustNumber = justNumber; OnCreated(); @@ -49,7 +49,7 @@ public NumberOnly(Option justNumber = default) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public Option JustNumber { get; set; } + public decimal JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option justNumber = default; + decimal? justNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = utf8JsonReader.GetDecimal(); break; default: break; @@ -131,12 +131,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber.Value == null) - throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + if (justNumber == null) + throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); - Option justNumberParsedValue = new Option(justNumber.Value.Value); - - return new NumberOnly(justNumberParsedValue); + return new NumberOnly(justNumber.Value); } /// @@ -163,8 +161,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (numberOnly.JustNumber.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); + writer.WriteNumber("JustNumber", numberOnly.JustNumber); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index 16ad6a31adf9..729b057bdb4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -40,7 +40,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -56,27 +56,27 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonPropertyName("bars")] [Obsolete] - public Option> Bars { get; set; } + public List Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public Option DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public Option Id { get; set; } + public decimal Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public string Uuid { get; set; } /// /// Gets or Sets additional properties @@ -134,10 +134,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> bars = default; - Option deprecatedRef = default; - Option id = default; - Option uuid = default; + List? bars = default; + DeprecatedObject? deprecatedRef = default; + decimal? id = default; + string? uuid = default; while (utf8JsonReader.Read()) { @@ -156,18 +156,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = utf8JsonReader.GetDecimal(); break; case "uuid": - uuid = new Option(utf8JsonReader.GetString()!); + uuid = utf8JsonReader.GetString(); break; default: break; @@ -175,24 +175,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars.Value == null) - throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (bars == null) + throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); - if (deprecatedRef.Value == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (deprecatedRef == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); - Option> barsParsedValue = new Option>(bars.Value); - Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); - Option idParsedValue = new Option(id.Value.Value); - Option uuidParsedValue = new Option(uuid.Value); - - return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); } /// @@ -219,24 +214,12 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - if (objectWithDeprecatedFields.Bars.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.DeprecatedRef.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Uuid.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Bars.IsSet) - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRef.IsSet) - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index 575f70b206a7..5283e0ae275d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -42,7 +42,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) { Id = id; PetId = petId; @@ -124,6 +124,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Placed) return "placed"; @@ -141,38 +142,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public Option PetId { get; set; } + public long PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public Option Quantity { get; set; } + public int Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public Option ShipDate { get; set; } + public DateTime ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public Option Complete { get; set; } + public bool Complete { get; set; } /// /// Gets or Sets additional properties @@ -237,12 +238,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option petId = default; - Option quantity = default; - Option shipDate = default; - Option status = default; - Option complete = default; + long? id = default; + long? petId = default; + int? quantity = default; + DateTime? shipDate = default; + Order.StatusEnum? status = default; + bool? complete = default; while (utf8JsonReader.Read()) { @@ -261,28 +262,29 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = utf8JsonReader.GetInt64(); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = utf8JsonReader.GetInt32(); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Order.StatusEnumFromStringOrDefault(statusRawValue); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = utf8JsonReader.GetBoolean(); break; default: break; @@ -290,32 +292,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - - if (petId.Value == null) - throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Order."); - if (quantity.Value == null) - throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + if (petId == null) + throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); - if (shipDate.Value == null) - throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + if (quantity == null) + throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + if (shipDate == null) + throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); - if (complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Order."); - Option idParsedValue = new Option(id.Value.Value); - Option petIdParsedValue = new Option(petId.Value.Value); - Option quantityParsedValue = new Option(quantity.Value.Value); - Option shipDateParsedValue = new Option(shipDate.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option completeParsedValue = new Option(complete.Value.Value); + if (complete == null) + throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); - return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); + return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); } /// @@ -342,18 +337,18 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + writer.WriteNumber("id", order.Id); + writer.WriteNumber("petId", order.PetId); + writer.WriteNumber("quantity", order.Quantity); + writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) - writer.WriteBoolean("complete", order.Complete.Value); + writer.WriteBoolean("complete", order.Complete); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index ea68b4888fe6..87526afade06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -39,7 +39,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + public OuterComposite(bool myBoolean, decimal myNumber, string myString) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -53,19 +53,19 @@ public OuterComposite(Option myBoolean = default, Option myNumber /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public Option MyBoolean { get; set; } + public bool MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public Option MyNumber { get; set; } + public decimal MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public Option MyString { get; set; } + public string MyString { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option myBoolean = default; - Option myNumber = default; - Option myString = default; + bool? myBoolean = default; + decimal? myNumber = default; + string? myString = default; while (utf8JsonReader.Read()) { @@ -143,14 +143,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = utf8JsonReader.GetBoolean(); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = utf8JsonReader.GetDecimal(); break; case "my_string": - myString = new Option(utf8JsonReader.GetString()!); + myString = utf8JsonReader.GetString(); break; default: break; @@ -158,20 +158,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean.Value == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + if (myBoolean == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); - if (myNumber.Value == null) - throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + if (myNumber == null) + throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); - if (myString.Value == null) - throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + if (myString == null) + throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); - Option myBooleanParsedValue = new Option(myBoolean.Value.Value); - Option myNumberParsedValue = new Option(myNumber.Value.Value); - Option myStringParsedValue = new Option(myString.Value); - - return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); + return new OuterComposite(myBoolean.Value, myNumber.Value, myString); } /// @@ -198,13 +194,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - if (outerComposite.MyString.Value == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value); + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); + writer.WriteNumber("my_number", outerComposite.MyNumber); + writer.WriteString("my_string", outerComposite.MyString); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs index 591371d2844d..1162f9a2a32d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs @@ -80,7 +80,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string? petType = default; while (utf8JsonReader.Read()) { @@ -98,7 +98,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()!); + petType = utf8JsonReader.GetString(); break; default: break; @@ -106,15 +106,10 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - - string petTypeParsedValue = petType.Value; - - return new ParentPet(petTypeParsedValue); + return new ParentPet(petType); } /// @@ -141,9 +136,6 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - if (parentPet.PetType == null) - throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index 7afd4963ae5e..8b15e328ca81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -35,19 +35,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name - /// photoUrls /// category /// id + /// name + /// photoUrls /// pet status in the store /// tags [JsonConstructor] - public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) { - Name = name; - PhotoUrls = photoUrls; Category = category; Id = id; + Name = name; + PhotoUrls = photoUrls; Status = status; Tags = tags; OnCreated(); @@ -124,6 +124,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Available) return "available"; @@ -141,7 +142,19 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long Id { get; set; } /// /// Gets or Sets Name @@ -156,23 +169,11 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Option Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public Option> Tags { get; set; } + public List Tags { get; set; } /// /// Gets or Sets additional properties @@ -188,10 +189,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -232,12 +233,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option?> photoUrls = default; - Option category = default; - Option id = default; - Option status = default; - Option?> tags = default; + Category? category = default; + long? id = default; + string? name = default; + List? photoUrls = default; + Pet.StatusEnum? status = default; + List? tags = default; while (utf8JsonReader.Read()) { @@ -254,29 +255,30 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; - case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Pet.StatusEnumFromStringOrDefault(statusRawValue); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -284,38 +286,25 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(name)); - - if (!photoUrls.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + if (category == null) + throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - if (photoUrls.Value == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - if (category.Value == null) - throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + if (photoUrls == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); - if (tags.Value == null) - throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + if (tags == null) + throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); - string nameParsedValue = name.Value; - List photoUrlsParsedValue = photoUrls.Value; - Option categoryParsedValue = new Option(category.Value); - Option idParsedValue = new Option(id.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option> tagsParsedValue = new Option>(tags.Value); - - return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); + return new Pet(category, id.Value, name, photoUrls, status.Value, tags); } /// @@ -342,33 +331,21 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - if (pet.Name == null) - throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); - - if (pet.PhotoUrls == null) - throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); - - if (pet.Category.Value == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - - if (pet.Tags.Value == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - - writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - if (pet.Category.IsSet) - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.Tags.IsSet) - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs index 4d67a08b23aa..3f9fdf20cd85 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs @@ -137,7 +137,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -188,7 +188,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -196,19 +196,14 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Pig.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); if (basquePig != null) - return new Pig(basquePig, classNameParsedValue); + return new Pig(basquePig, className); if (danishPig != null) - return new Pig(danishPig, classNameParsedValue); + return new Pig(danishPig, className); throw new JsonException(); } @@ -247,9 +242,6 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - if (pig.ClassName == null) - throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs index e46a75f3c6e9..8b6c244ab73d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs @@ -137,7 +137,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string? quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -188,7 +188,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -196,19 +196,14 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); - - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(complexQuadrilateral, quadrilateralType); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType); throw new JsonException(); } @@ -247,9 +242,6 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs index 39df3b0b91e7..91f6a55eb207 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs @@ -104,7 +104,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string? quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -130,15 +130,10 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - - return new QuadrilateralInterface(quadrilateralTypeParsedValue); + return new QuadrilateralInterface(quadrilateralType); } /// @@ -165,9 +160,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateralInterface.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index 266640a22223..5ecf54003200 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -38,7 +38,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(Option bar = default, Option baz = default) + public ReadOnlyFirst(string bar, string baz) { Bar = bar; Baz = baz; @@ -51,13 +51,13 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public Option Baz { get; set; } + public string Baz { get; set; } /// /// Gets or Sets additional properties @@ -149,8 +149,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option baz = default; + string? bar = default; + string? baz = default; while (utf8JsonReader.Read()) { @@ -168,10 +168,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; case "baz": - baz = new Option(utf8JsonReader.GetString()!); + baz = utf8JsonReader.GetString(); break; default: break; @@ -179,16 +179,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); - if (baz.Value == null) - throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + if (baz == null) + throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); - Option barParsedValue = new Option(bar.Value); - Option bazParsedValue = new Option(baz.Value); - - return new ReadOnlyFirst(barParsedValue, bazParsedValue); + return new ReadOnlyFirst(bar, baz); } /// @@ -215,15 +212,8 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - if (readOnlyFirst.Bar.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Baz.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value); + writer.WriteString("bar", readOnlyFirst.Bar); + writer.WriteString("baz", readOnlyFirst.Baz); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs deleted file mode 100644 index 170c76292283..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ /dev/null @@ -1,2212 +0,0 @@ -// -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using OpenAPIClientUtils = UseSourceGeneration.Client.ClientUtils; -using System.Text.Json.Serialization.Metadata; -using UseSourceGeneration.Client; - -namespace UseSourceGeneration.Model -{ - /// - /// RequiredClass - /// - public partial class RequiredClass : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// requiredNotNullableDateProp - /// requiredNotnullableArrayOfString - /// requiredNotnullableBooleanProp - /// requiredNotnullableDatetimeProp - /// requiredNotnullableEnumInteger - /// requiredNotnullableEnumIntegerOnly - /// requiredNotnullableEnumString - /// requiredNotnullableOuterEnumDefaultValue - /// requiredNotnullableStringProp - /// requiredNotnullableUuid - /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid - /// requiredNullableArrayOfString - /// requiredNullableBooleanProp - /// requiredNullableDateProp - /// requiredNullableDatetimeProp - /// requiredNullableEnumInteger - /// requiredNullableEnumIntegerOnly - /// requiredNullableEnumString - /// requiredNullableIntegerProp - /// requiredNullableOuterEnumDefaultValue - /// requiredNullableStringProp - /// requiredNullableUuid - /// notRequiredNullableDateProp - /// notRequiredNullableIntegerProp - /// notrequiredNullableArrayOfString - /// notrequiredNullableBooleanProp - /// notrequiredNullableDatetimeProp - /// notrequiredNullableEnumInteger - /// notrequiredNullableEnumIntegerOnly - /// notrequiredNullableEnumString - /// notrequiredNullableOuterEnumDefaultValue - /// notrequiredNullableStringProp - /// notrequiredNullableUuid - [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) - { - RequiredNotNullableDateProp = requiredNotNullableDateProp; - RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - RequiredNotnullableEnumString = requiredNotnullableEnumString; - RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - RequiredNotnullableStringProp = requiredNotnullableStringProp; - RequiredNotnullableUuid = requiredNotnullableUuid; - RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - RequiredNullableArrayOfString = requiredNullableArrayOfString; - RequiredNullableBooleanProp = requiredNullableBooleanProp; - RequiredNullableDateProp = requiredNullableDateProp; - RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - RequiredNullableEnumInteger = requiredNullableEnumInteger; - RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - RequiredNullableEnumString = requiredNullableEnumString; - RequiredNullableIntegerProp = requiredNullableIntegerProp; - RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - RequiredNullableStringProp = requiredNullableStringProp; - RequiredNullableUuid = requiredNullableUuid; - NotRequiredNullableDateProp = notRequiredNullableDateProp; - NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - NotrequiredNullableEnumString = notrequiredNullableEnumString; - NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - NotrequiredNullableStringProp = notrequiredNullableStringProp; - NotrequiredNullableUuid = notrequiredNullableUuid; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNotnullableEnumString - /// - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) - { - if (value == RequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public Option NotrequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumString - /// - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) - { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public Option NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } - - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNullableEnumString - /// - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [JsonPropertyName("notrequired_nullable_enum_integer")] - public Option NotrequiredNullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public Option NotrequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNullableEnumString - /// - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == NotrequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [JsonPropertyName("notrequired_nullable_enum_string")] - public Option NotrequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public Option NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public Option NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public Option> NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public Option NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public Option NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public Option NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Option NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [JsonPropertyName("not_required_nullable_date_prop")] - public Option NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public Option NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [JsonPropertyName("notrequired_nullable_array_of_string")] - public Option?> NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [JsonPropertyName("notrequired_nullable_boolean_prop")] - public Option NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [JsonPropertyName("notrequired_nullable_datetime_prop")] - public Option NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [JsonPropertyName("notrequired_nullable_string_prop")] - public Option NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_nullable_uuid")] - public Option NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; } = new Dictionary(); - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class RequiredClassJsonConverter : JsonConverter - { - /// - /// The format to use to serialize RequiredNotNullableDateProp - /// - public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNotnullableDatetimeProp - /// - public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize RequiredNullableDateProp - /// - public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNullableDatetimeProp - /// - public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNullableDateProp - /// - public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNullableDatetimeProp - /// - public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option requiredNotNullableDateProp = default; - Option?> requiredNotnullableArrayOfString = default; - Option requiredNotnullableBooleanProp = default; - Option requiredNotnullableDatetimeProp = default; - Option requiredNotnullableEnumInteger = default; - Option requiredNotnullableEnumIntegerOnly = default; - Option requiredNotnullableEnumString = default; - Option requiredNotnullableOuterEnumDefaultValue = default; - Option requiredNotnullableStringProp = default; - Option requiredNotnullableUuid = default; - Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option?> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; - Option?> requiredNullableArrayOfString = default; - Option requiredNullableBooleanProp = default; - Option requiredNullableDateProp = default; - Option requiredNullableDatetimeProp = default; - Option requiredNullableEnumInteger = default; - Option requiredNullableEnumIntegerOnly = default; - Option requiredNullableEnumString = default; - Option requiredNullableIntegerProp = default; - Option requiredNullableOuterEnumDefaultValue = default; - Option requiredNullableStringProp = default; - Option requiredNullableUuid = default; - Option notRequiredNullableDateProp = default; - Option notRequiredNullableIntegerProp = default; - Option?> notrequiredNullableArrayOfString = default; - Option notrequiredNullableBooleanProp = default; - Option notrequiredNullableDatetimeProp = default; - Option notrequiredNullableEnumInteger = default; - Option notrequiredNullableEnumIntegerOnly = default; - Option notrequiredNullableEnumString = default; - Option notrequiredNullableOuterEnumDefaultValue = default; - Option notrequiredNullableStringProp = default; - Option notrequiredNullableUuid = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string? localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)!); - break; - case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_notnullable_enum_string": - string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableEnumStringRawValue != null) - requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); - break; - case "required_notnullable_outerEnumDefaultValue": - string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableOuterEnumDefaultValueRawValue != null) - requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "required_notnullable_string_prop": - requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_string": - string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNullableEnumStringRawValue != null) - requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); - break; - case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "required_nullable_outerEnumDefaultValue": - string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); - break; - case "required_nullable_string_prop": - requiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_nullable_enum_string": - string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableEnumStringRawValue != null) - notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); - break; - case "notrequired_nullable_outerEnumDefaultValue": - string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableOuterEnumDefaultValueRawValue != null) - notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_nullable_string_prop": - notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - default: - break; - } - } - } - - if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); - - if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); - - if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); - - if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); - - if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); - - if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); - - if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); - - if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); - - if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); - - if (!requiredNotnullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); - - if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); - - if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); - - if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); - - if (!requiredNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); - - if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); - - if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); - - if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); - - if (!requiredNullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); - - if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); - - if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); - - if (!requiredNullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); - - if (!requiredNullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); - - if (requiredNotNullableDateProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableDateProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; - List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; - bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; - DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; - RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; - OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; - string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; - Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; - int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; - Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); - Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); - Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); - Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); - Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); - Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); - Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); - Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); - Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); - Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); - Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); - List? requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; - bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; - DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; - DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; - RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; - RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; - RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; - int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; - OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; - string? requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; - Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; - - return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(ref writer, requiredClass, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - if (requiredClass.RequiredNotnullableArrayOfString == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.RequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); - if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); - else - writer.WriteNull("required_notnullable_enum_string"); - - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) - { - writer.WritePropertyName("required_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); - if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); - else - writer.WriteNull("required_nullable_enum_string"); - - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - else - { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); - else - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - } - - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) - if (requiredClass.NotrequiredNullableArrayOfString.Value != null) - { - writer.WritePropertyName("notrequired_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); - if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); - else - writer.WriteNull("notrequired_nullable_enum_string"); - - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) - { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); - writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); - } - else - writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else - writer.WriteNull("notrequired_nullable_uuid"); - } - } - - /// - /// The RequiredClassSerializationContext - /// - [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] - [JsonSerializable(typeof(RequiredClass))] - public partial class RequiredClassSerializationContext : JsonSerializerContext { } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs index 4b0ce0f7f110..454e16dd0f52 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs @@ -37,7 +37,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(Option varReturn = default) + public Return(int varReturn) { VarReturn = varReturn; OnCreated(); @@ -49,7 +49,7 @@ public Return(Option varReturn = default) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public Option VarReturn { get; set; } + public int VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varReturn = default; + int? varReturn = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = utf8JsonReader.GetInt32(); break; default: break; @@ -131,12 +131,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn.Value == null) - throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + if (varReturn == null) + throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); - Option varReturnParsedValue = new Option(varReturn.Value.Value); - - return new Return(varReturnParsedValue); + return new Return(varReturn.Value); } /// @@ -163,8 +161,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.VarReturn.IsSet) - writer.WriteNumber("return", varReturn.VarReturn.Value); + writer.WriteNumber("return", varReturn.VarReturn); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index d05426562dd4..3485ce95577c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -38,7 +38,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(Option role = default, Option roleUuid = default) + public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) { Role = role; RoleUuid = roleUuid; @@ -51,13 +51,13 @@ public RolesReportsHash(Option role = default, Option [JsonPropertyName("role")] - public Option Role { get; set; } + public RolesReportsHashRole Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Option RoleUuid { get; set; } + public Guid RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option role = default; - Option roleUuid = default; + RolesReportsHashRole? role = default; + Guid? roleUuid = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = utf8JsonReader.GetGuid(); break; default: break; @@ -145,16 +145,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role.Value == null) - throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + if (role == null) + throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); - if (roleUuid.Value == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + if (roleUuid == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); - Option roleParsedValue = new Option(role.Value); - Option roleUuidParsedValue = new Option(roleUuid.Value.Value); - - return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); + return new RolesReportsHash(role, roleUuid.Value); } /// @@ -181,14 +178,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHash.Role.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - - if (rolesReportsHash.Role.IsSet) - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 0b6e020ef738..9c20ab46bad7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -37,7 +37,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(Option name = default) + public RolesReportsHashRole(string name) { Name = name; OnCreated(); @@ -49,7 +49,7 @@ public RolesReportsHashRole(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); - Option nameParsedValue = new Option(name.Value); - - return new RolesReportsHashRole(nameParsedValue); + return new RolesReportsHashRole(name); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHashRole.Name.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); - - if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value); + writer.WriteString("name", rolesReportsHashRole.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index f5b18a700216..39f7d8cc72f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -113,8 +113,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -143,22 +143,13 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new ScaleneTriangle(shapeType, triangleType); } /// @@ -185,13 +176,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (scaleneTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); - - if (scaleneTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - - writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs index 39e5a1dbbd32..7100b878d3bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs @@ -137,7 +137,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -196,19 +196,14 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeTypeParsedValue); + return new Shape(quadrilateral, shapeType); if (triangle != null) - return new Shape(triangle, shapeTypeParsedValue); + return new Shape(triangle, shapeType); throw new JsonException(); } @@ -247,9 +242,6 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - if (shape.ShapeType == null) - throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs index c013ddca885c..0a994154af08 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs @@ -104,7 +104,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -130,15 +130,10 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - - string shapeTypeParsedValue = shapeType.Value; - - return new ShapeInterface(shapeTypeParsedValue); + return new ShapeInterface(shapeType); } /// @@ -165,9 +160,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - if (shapeInterface.ShapeType == null) - throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs index 56a97dde8965..c0b313a2f362 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs @@ -137,7 +137,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -196,19 +196,14 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); + return new ShapeOrNull(quadrilateral, shapeType); if (triangle != null) - return new ShapeOrNull(triangle, shapeTypeParsedValue); + return new ShapeOrNull(triangle, shapeType); throw new JsonException(); } @@ -247,9 +242,6 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - if (shapeOrNull.ShapeType == null) - throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index aaef1c1d88a6..c41dcdc9dcf6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -113,8 +113,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string? quadrilateralType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -143,22 +143,13 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new SimpleQuadrilateral(quadrilateralType, shapeType); } /// @@ -185,13 +176,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (simpleQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); - - if (simpleQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 4f1c8f6e0745..06b9d48e4696 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -38,7 +38,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + public SpecialModelName(string varSpecialModelName, long specialPropertyName) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -51,13 +51,13 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonPropertyName("_special_model.name_")] - public Option VarSpecialModelName { get; set; } + public string VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public Option SpecialPropertyName { get; set; } + public long SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varSpecialModelName = default; - Option specialPropertyName = default; + string? varSpecialModelName = default; + long? specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -132,11 +132,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = new Option(utf8JsonReader.GetString()!); + varSpecialModelName = utf8JsonReader.GetString(); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = utf8JsonReader.GetInt64(); break; default: break; @@ -144,16 +144,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + if (varSpecialModelName == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); - if (specialPropertyName.Value == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + if (specialPropertyName == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); - Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); - Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); - - return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); + return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); } /// @@ -180,12 +177,8 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - if (specialModelName.VarSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index b290f8a6a7bb..1bf8c4ad9a0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -38,7 +38,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(Option id = default, Option name = default) + public Tag(long id, string name) { Id = id; Name = name; @@ -51,13 +51,13 @@ public Tag(Option id = default, Option name = default) /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option name = default; + long? id = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -133,10 +133,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -144,16 +144,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); - Option idParsedValue = new Option(id.Value.Value); - Option nameParsedValue = new Option(name.Value); - - return new Tag(idParsedValue, nameParsedValue); + return new Tag(id.Value, name); } /// @@ -180,12 +177,8 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - if (tag.Name.Value == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value); + writer.WriteNumber("id", tag.Id); + writer.WriteString("name", tag.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index f2ffac9551ee..4249ff2fb47b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -37,7 +37,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(Option value = default) + public TestCollectionEndingWithWordList(string value) { Value = value; OnCreated(); @@ -49,7 +49,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Gets or Sets Value /// [JsonPropertyName("value")] - public Option Value { get; set; } + public string Value { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option value = default; + string? value = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = new Option(utf8JsonReader.GetString()!); + value = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +130,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value.Value == null) - throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + if (value == null) + throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); - Option valueParsedValue = new Option(value.Value); - - return new TestCollectionEndingWithWordList(valueParsedValue); + return new TestCollectionEndingWithWordList(value); } /// @@ -162,11 +160,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordList.Value.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); - - if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index e9522dba90b4..ed130760a758 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -37,7 +37,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -49,7 +49,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonPropertyName("TestCollectionEndingWithWordList")] - public Option> TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> testCollectionEndingWithWordList = default; + List? testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -123,7 +123,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -131,12 +131,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); - - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -163,12 +161,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index be74347d46f0..dd3c3ec026a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -37,7 +37,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() + public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() { SomeProperty = someProperty; OnCreated(); @@ -49,7 +49,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public Option SomeProperty { get; set; } + public string SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -115,7 +115,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option someProperty = default; + string? someProperty = default; while (utf8JsonReader.Read()) { @@ -133,7 +133,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = new Option(utf8JsonReader.GetString()!); + someProperty = utf8JsonReader.GetString(); break; default: break; @@ -141,12 +141,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty.Value == null) - throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty == null) + throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - Option somePropertyParsedValue = new Option(someProperty.Value); - - return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -173,11 +171,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs index 960e47030383..bddcf663a293 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs @@ -154,7 +154,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string? triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -211,7 +211,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -219,22 +219,17 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); - - string triangleTypeParsedValue = triangleType.Value; + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleTypeParsedValue); + return new Triangle(equilateralTriangle, triangleType); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleTypeParsedValue); + return new Triangle(isoscelesTriangle, triangleType); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleTypeParsedValue); + return new Triangle(scaleneTriangle, triangleType); throw new JsonException(); } @@ -278,9 +273,6 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - if (triangle.TriangleType == null) - throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs index 3aaf01207b70..adc70c646cb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs @@ -104,7 +104,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -130,15 +130,10 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - - string triangleTypeParsedValue = triangleType.Value; - - return new TriangleInterface(triangleTypeParsedValue); + return new TriangleInterface(triangleType); } /// @@ -165,9 +160,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - if (triangleInterface.TriangleType == null) - throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 9411a42098bd..684c3ff5a2e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -48,7 +48,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -71,78 +71,78 @@ public User(Option email = default, Option firstName = default, /// Gets or Sets Email /// [JsonPropertyName("email")] - public Option Email { get; set; } + public string Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public Option FirstName { get; set; } + public string FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public Option LastName { get; set; } + public string LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Option ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public Option Password { get; set; } + public string Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public Option Phone { get; set; } + public string Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public Option UserStatus { get; set; } + public int UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public Option Username { get; set; } + public string Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Option AnyTypeProp { get; set; } + public Object? AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Option AnyTypePropNullable { get; set; } + public Object? AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Option ObjectWithNoDeclaredPropsNullable { get; set; } + public Object? ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -208,18 +208,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option email = default; - Option firstName = default; - Option id = default; - Option lastName = default; - Option objectWithNoDeclaredProps = default; - Option password = default; - Option phone = default; - Option userStatus = default; - Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; + string? email = default; + string? firstName = default; + long? id = default; + string? lastName = default; + Object? objectWithNoDeclaredProps = default; + string? password = default; + string? phone = default; + int? userStatus = default; + string? username = default; + Object? anyTypeProp = default; + Object? anyTypePropNullable = default; + Object? objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -237,46 +237,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = new Option(utf8JsonReader.GetString()!); + email = utf8JsonReader.GetString(); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = utf8JsonReader.GetString(); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + lastName = utf8JsonReader.GetString(); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "password": - password = new Option(utf8JsonReader.GetString()!); + password = utf8JsonReader.GetString(); break; case "phone": - phone = new Option(utf8JsonReader.GetString()!); + phone = utf8JsonReader.GetString(); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = utf8JsonReader.GetInt32(); break; case "username": - username = new Option(utf8JsonReader.GetString()!); + username = utf8JsonReader.GetString(); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -284,44 +284,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email.Value == null) - throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + if (email == null) + throw new ArgumentNullException(nameof(email), "Property is required for class User."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class User."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); - if (objectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + if (objectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class User."); - if (phone.Value == null) - throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + if (phone == null) + throw new ArgumentNullException(nameof(phone), "Property is required for class User."); - if (userStatus.Value == null) - throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + if (userStatus == null) + throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); - if (username.Value == null) - throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + if (username == null) + throw new ArgumentNullException(nameof(username), "Property is required for class User."); - Option emailParsedValue = new Option(email.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option idParsedValue = new Option(id.Value.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); - Option passwordParsedValue = new Option(password.Value); - Option phoneParsedValue = new Option(phone.Value); - Option userStatusParsedValue = new Option(userStatus.Value.Value); - Option usernameParsedValue = new Option(username.Value); - - return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -348,62 +338,22 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - if (user.Email.Value == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); - - if (user.FirstName.Value == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); - - if (user.LastName.Value == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); - - if (user.ObjectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); - - if (user.Password.Value == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); - - if (user.Phone.Value == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); - - if (user.Username.Value == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) - if (user.AnyTypeProp.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullable.IsSet) - if (user.AnyTypePropNullable.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullable.IsSet) - if (user.ObjectWithNoDeclaredPropsNullable.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); + writer.WriteString("email", user.Email); + writer.WriteString("firstName", user.FirstName); + writer.WriteNumber("id", user.Id); + writer.WriteString("lastName", user.LastName); + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); + writer.WriteString("phone", user.Phone); + writer.WriteNumber("userStatus", user.UserStatus); + writer.WriteString("username", user.Username); + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index 8f91b1a1b048..7d320ced8bb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -39,7 +39,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + public Whale(string className, bool hasBaleen, bool hasTeeth) { ClassName = className; HasBaleen = hasBaleen; @@ -59,13 +59,13 @@ public Whale(string className, Option hasBaleen = default, Option ha /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public Option HasBaleen { get; set; } + public bool HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public Option HasTeeth { get; set; } + public bool HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -122,9 +122,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option hasBaleen = default; - Option hasTeeth = default; + string? className = default; + bool? hasBaleen = default; + bool? hasTeeth = default; while (utf8JsonReader.Read()) { @@ -142,15 +142,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = utf8JsonReader.GetBoolean(); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = utf8JsonReader.GetBoolean(); break; default: break; @@ -158,23 +158,16 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Whale.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + if (hasBaleen == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); - if (hasBaleen.Value == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + if (hasTeeth == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); - if (hasTeeth.Value == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - - string classNameParsedValue = className.Value; - Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); - Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); - - return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); + return new Whale(className, hasBaleen.Value, hasTeeth.Value); } /// @@ -201,12 +194,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - if (whale.ClassName == null) - throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - - writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); + writer.WriteString("className", whale.ClassName); + writer.WriteBoolean("hasBaleen", whale.HasBaleen); + writer.WriteBoolean("hasTeeth", whale.HasTeeth); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 89deaa9b2d22..05aa8852c983 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -38,7 +38,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, Option type = default) : base() + public Zebra(string className, TypeEnum type) : base() { ClassName = className; Type = type; @@ -115,6 +115,7 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { + if (value == TypeEnum.Plains) return "plains"; @@ -131,7 +132,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public TypeEnum Type { get; set; } /// /// Gets or Sets ClassName @@ -204,8 +205,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option type = default; + string? className = default; + Zebra.TypeEnum? type = default; while (utf8JsonReader.Read()) { @@ -223,12 +224,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - if (typeRawValue != null) - type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + type = typeRawValue == null + ? null + : Zebra.TypeEnumFromStringOrDefault(typeRawValue); break; default: break; @@ -236,19 +238,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Zebra.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - string classNameParsedValue = className.Value; - Option typeParsedValue = new Option(type.Value.Value); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); - return new Zebra(classNameParsedValue, typeParsedValue); + return new Zebra(className, type.Value); } /// @@ -275,10 +271,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - if (zebra.ClassName == null) - throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); - writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index 44b71de59c32..4240d64e5bdc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -37,7 +37,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(Option zeroBasedEnum = default) + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -102,6 +102,7 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { + if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -115,7 +116,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public Option ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -170,7 +171,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option zeroBasedEnum = default; + ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -189,8 +190,9 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - if (zeroBasedEnumRawValue != null) - zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + zeroBasedEnum = zeroBasedEnumRawValue == null + ? null + : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); break; default: break; @@ -198,12 +200,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum.Value == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - - Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); + return new ZeroBasedEnumClass(zeroBasedEnum.Value); } /// @@ -230,7 +230,8 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index 05049077c2ac..1179de6767be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -79,7 +79,6 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md -docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -207,7 +206,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md index 470701a32abc..53bbfe31e77c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md index ab628ed7bc0b..28f1a8093581 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md @@ -4,11 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | -**Number** | **decimal** | | -**Password** | **string** | | -**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -16,6 +14,8 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] +**Number** | **decimal** | | +**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md index 4f019b613bd7..b13bb576b450 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | -**PhotoUrls** | **List<string>** | | **Category** | [**Category**](Category.md) | | [optional] **Id** | **long** | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md deleted file mode 100644 index 5ff4cb1b73cc..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNotNullableDateProp** | **DateTime** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNotnullableEnumInteger** | **int** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**RequiredNotnullableEnumString** | **string** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableStringProp** | **string** | | -**RequiredNotnullableUuid** | **Guid** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNullableBooleanProp** | **bool** | | -**RequiredNullableDateProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime** | | -**RequiredNullableEnumInteger** | **int** | | -**RequiredNullableEnumIntegerOnly** | **int** | | -**RequiredNullableEnumString** | **string** | | -**RequiredNullableIntegerProp** | **int** | | -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNullableStringProp** | **string** | | -**RequiredNullableUuid** | **Guid** | | -**NotRequiredNullableDateProp** | **DateTime** | | [optional] -**NotRequiredNullableIntegerProp** | **int** | | [optional] -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNullableBooleanProp** | **bool** | | [optional] -**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNullableEnumInteger** | **int** | | [optional] -**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNullableUuid** | **Guid** | | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index feaae2e67180..758fb96ce8b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,16 +219,6 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } - /// - /// Test TestInlineFreeformAdditionalProperties - /// - [Fact (Skip = "not implemented")] - public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() - { - TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default!; - await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); - } - /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index b78fc06d07c5..7fe8f333c81a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index bfec38903066..e5a97f428662 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,15 +53,6 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'EnumInteger' /// @@ -98,6 +89,15 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index 164baa8862be..fbffe502af78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -54,48 +54,30 @@ public void FormatTestInstanceTest() } /// - /// Test the property 'VarByte' - /// - [Fact] - public void VarByteTest() - { - // TODO unit test for the property 'VarByte' - } - - /// - /// Test the property 'Date' - /// - [Fact] - public void DateTest() - { - // TODO unit test for the property 'Date' - } - - /// - /// Test the property 'Number' + /// Test the property 'Binary' /// [Fact] - public void NumberTest() + public void BinaryTest() { - // TODO unit test for the property 'Number' + // TODO unit test for the property 'Binary' } /// - /// Test the property 'Password' + /// Test the property 'VarByte' /// [Fact] - public void PasswordTest() + public void VarByteTest() { - // TODO unit test for the property 'Password' + // TODO unit test for the property 'VarByte' } /// - /// Test the property 'Binary' + /// Test the property 'Date' /// [Fact] - public void BinaryTest() + public void DateTest() { - // TODO unit test for the property 'Binary' + // TODO unit test for the property 'Date' } /// @@ -161,6 +143,24 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs index 8485d1213ce6..fff8db45faad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 6e8958b1b749..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,452 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index e3234dee5bb2..ec7ac60448eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -143,8 +143,6 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -153,6 +151,8 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -169,30 +169,6 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) - return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) - return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) - return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) - return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) - return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) - return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs index a26741d84b71..968417a9e748 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -116,7 +116,6 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); - _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs index 4af2a7715ee6..7aa655c9b813 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs @@ -37,17 +37,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index b9f9fedaa5cd..22464eec75fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Option>> activityOutputs = default) + public Activity(Dictionary> activityOutputs) { ActivityOutputs = activityOutputs; OnCreated(); @@ -48,7 +47,7 @@ public Activity(Option [JsonPropertyName("activity_outputs")] - public Option>> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> activityOutputs = default; + Dictionary>? activityOutputs = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -130,12 +129,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs.Value == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + if (activityOutputs == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); - Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); - - return new Activity(activityOutputsParsedValue); + return new Activity(activityOutputs); } /// @@ -162,12 +159,8 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - if (activity.ActivityOutputs.Value == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - - if (activity.ActivityOutputs.IsSet) - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 47ab40e12266..39c2e8b05e60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + public ActivityOutputElementRepresentation(string prop1, Object prop2) { Prop1 = prop1; Prop2 = prop2; @@ -50,13 +49,13 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public Option Prop1 { get; set; } + public string Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Option Prop2 { get; set; } + public Object Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option prop1 = default; - Option prop2 = default; + string? prop1 = default; + Object? prop2 = default; while (utf8JsonReader.Read()) { @@ -131,11 +130,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = new Option(utf8JsonReader.GetString()!); + prop1 = utf8JsonReader.GetString(); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -143,16 +142,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1.Value == null) - throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop1 == null) + throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); - if (prop2.Value == null) - throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop2 == null) + throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); - Option prop1ParsedValue = new Option(prop1.Value); - Option prop2ParsedValue = new Option(prop2.Value); - - return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -179,16 +175,9 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - if (activityOutputElementRepresentation.Prop1.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop2.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 5629ced55a8e..37ab8b4f3b4a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -43,7 +42,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -63,49 +62,49 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Option EmptyMap { get; set; } + public Object EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Option>> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Option> MapProperty { get; set; } + public Dictionary MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Option> MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Option Anytype1 { get; set; } + public Object? Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -167,14 +166,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option emptyMap = default; - Option>?> mapOfMapProperty = default; - Option?> mapProperty = default; - Option mapWithUndeclaredPropertiesAnytype1 = default; - Option mapWithUndeclaredPropertiesAnytype2 = default; - Option?> mapWithUndeclaredPropertiesAnytype3 = default; - Option?> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; + Object? emptyMap = default; + Dictionary>? mapOfMapProperty = default; + Dictionary? mapProperty = default; + Object? mapWithUndeclaredPropertiesAnytype1 = default; + Object? mapWithUndeclaredPropertiesAnytype2 = default; + Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; + Dictionary? mapWithUndeclaredPropertiesString = default; + Object? anytype1 = default; while (utf8JsonReader.Read()) { @@ -193,35 +192,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -229,36 +228,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap.Value == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + if (emptyMap == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); - if (mapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapOfMapProperty == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapProperty.Value == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapProperty == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - Option emptyMapParsedValue = new Option(emptyMap.Value); - Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); - Option> mapPropertyParsedValue = new Option>(mapProperty.Value); - Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); - Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); - Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); - Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); - - return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -285,56 +276,22 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (additionalPropertiesClass.EmptyMap.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.EmptyMap.IsSet) - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapProperty.IsSet) - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapProperty.IsSet) - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1.IsSet) - if (additionalPropertiesClass.Anytype1.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 2a821b2ba116..dd36cad83283 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, Option color = default) + public Animal(string className, string color = @"red") { ClassName = className; Color = color; @@ -56,7 +55,7 @@ public Animal(string className, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -122,8 +121,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option color = default; + string? className = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -141,10 +140,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -152,19 +151,13 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Animal.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - - string classNameParsedValue = className.Value; - Option colorParsedValue = new Option(color.Value); - - return new Animal(classNameParsedValue, colorParsedValue); + return new Animal(className, color); } /// @@ -191,14 +184,8 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - if (animal.ClassName == null) - throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); - - if (animal.Color.Value == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - - writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value); + writer.WriteString("className", animal.ClassName); + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index 6fb56e69d300..a9e4c983c629 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(Option code = default, Option message = default, Option type = default) + public ApiResponse(int code, string message, string type) { Code = code; Message = message; @@ -52,19 +51,19 @@ public ApiResponse(Option code = default, Option message = default, /// Gets or Sets Code /// [JsonPropertyName("code")] - public Option Code { get; set; } + public int Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public Option Message { get; set; } + public string Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public string Type { get; set; } /// /// Gets or Sets additional properties @@ -121,9 +120,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option code = default; - Option message = default; - Option type = default; + int? code = default; + string? message = default; + string? type = default; while (utf8JsonReader.Read()) { @@ -142,13 +141,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = utf8JsonReader.GetInt32(); break; case "message": - message = new Option(utf8JsonReader.GetString()!); + message = utf8JsonReader.GetString(); break; case "type": - type = new Option(utf8JsonReader.GetString()!); + type = utf8JsonReader.GetString(); break; default: break; @@ -156,20 +155,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code.Value == null) - throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + if (code == null) + throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); - if (message.Value == null) - throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + if (message == null) + throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); - Option codeParsedValue = new Option(code.Value.Value); - Option messageParsedValue = new Option(message.Value); - Option typeParsedValue = new Option(type.Value); - - return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); + return new ApiResponse(code.Value, message, type); } /// @@ -196,16 +191,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - if (apiResponse.Message.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); - - if (apiResponse.Type.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value); + writer.WriteNumber("code", apiResponse.Code); + writer.WriteString("message", apiResponse.Message); + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index fc6483922321..39c4ddd6c25b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + public Apple(string colorCode, string cultivar, string origin) { ColorCode = colorCode; Cultivar = cultivar; @@ -52,19 +51,19 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public Option ColorCode { get; set; } + public string ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public Option Cultivar { get; set; } + public string Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public Option Origin { get; set; } + public string Origin { get; set; } /// /// Gets or Sets additional properties @@ -95,28 +94,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode.Value != null) { + if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode.Value).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar.Value != null) { + if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar.Value).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin.Value != null) { + if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin.Value).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -148,9 +147,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option colorCode = default; - Option cultivar = default; - Option origin = default; + string? colorCode = default; + string? cultivar = default; + string? origin = default; while (utf8JsonReader.Read()) { @@ -168,13 +167,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = new Option(utf8JsonReader.GetString()!); + colorCode = utf8JsonReader.GetString(); break; case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()!); + cultivar = utf8JsonReader.GetString(); break; case "origin": - origin = new Option(utf8JsonReader.GetString()!); + origin = utf8JsonReader.GetString(); break; default: break; @@ -182,20 +181,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode.Value == null) - throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + if (colorCode == null) + throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); - if (origin.Value == null) - throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + if (origin == null) + throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); - Option colorCodeParsedValue = new Option(colorCode.Value); - Option cultivarParsedValue = new Option(cultivar.Value); - Option originParsedValue = new Option(origin.Value); - - return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); + return new Apple(colorCode, cultivar, origin); } /// @@ -222,19 +217,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.ColorCode.Value == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); - - if (apple.Cultivar.Value == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); - - if (apple.Origin.Value == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value); + writer.WriteString("color_code", apple.ColorCode); + writer.WriteString("cultivar", apple.Cultivar); + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 56bfa0fa3603..ca139374d181 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, Option mealy = default) + public AppleReq(string cultivar, bool mealy) { Cultivar = cultivar; Mealy = mealy; @@ -56,7 +55,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public Option Mealy { get; set; } + public bool Mealy { get; set; } /// /// Returns the string presentation of the object @@ -105,8 +104,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option cultivar = default; - Option mealy = default; + string? cultivar = default; + bool? mealy = default; while (utf8JsonReader.Read()) { @@ -124,11 +123,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()!); + cultivar = utf8JsonReader.GetString(); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = utf8JsonReader.GetBoolean(); break; default: break; @@ -136,19 +135,13 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!cultivar.IsSet) - throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + if (mealy == null) + throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); - if (mealy.Value == null) - throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - - string cultivarParsedValue = cultivar.Value; - Option mealyParsedValue = new Option(mealy.Value.Value); - - return new AppleReq(cultivarParsedValue, mealyParsedValue); + return new AppleReq(cultivar, mealy.Value); } /// @@ -175,11 +168,8 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - if (appleReq.Cultivar == null) - throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - - writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) - writer.WriteBoolean("mealy", appleReq.Mealy.Value); + writer.WriteString("cultivar", appleReq.Cultivar); + writer.WriteBoolean("mealy", appleReq.Mealy); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 8963a6632ca7..78ae23d63d61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -48,7 +47,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public Option>> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> arrayArrayNumber = default; + List>? arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -130,12 +129,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); - - return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -162,12 +159,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 71a99803b701..29af43d6c8b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(Option> arrayNumber = default) + public ArrayOfNumberOnly(List arrayNumber) { ArrayNumber = arrayNumber; OnCreated(); @@ -48,7 +47,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public Option> ArrayNumber { get; set; } + public List ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayNumber = default; + List? arrayNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -130,12 +129,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + if (arrayNumber == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); - Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); - - return new ArrayOfNumberOnly(arrayNumberParsedValue); + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -162,12 +159,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfNumberOnly.ArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - - if (arrayOfNumberOnly.ArrayNumber.IsSet) - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 24fefcddbc98..c021f61cca54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -52,19 +51,19 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public Option>> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public Option>> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public Option> ArrayOfString { get; set; } + public List ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -121,9 +120,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> arrayArrayOfInteger = default; - Option>?> arrayArrayOfModel = default; - Option?> arrayOfString = default; + List>? arrayArrayOfInteger = default; + List>? arrayArrayOfModel = default; + List? arrayOfString = default; while (utf8JsonReader.Read()) { @@ -142,15 +141,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -158,20 +157,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); - if (arrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); - if (arrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + if (arrayOfString == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); - Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); - Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); - Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); - - return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -198,24 +193,12 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - if (arrayTest.ArrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfInteger.IsSet) - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModel.IsSet) - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfString.IsSet) - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index 3f1ac483677c..a73515d6023b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(Option lengthCm = default) + public Banana(decimal lengthCm) { LengthCm = lengthCm; OnCreated(); @@ -48,7 +47,7 @@ public Banana(Option lengthCm = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public Option LengthCm { get; set; } + public decimal LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; + decimal? lengthCm = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; default: break; @@ -130,12 +129,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); - Option lengthCmParsedValue = new Option(lengthCm.Value.Value); - - return new Banana(lengthCmParsedValue); + return new Banana(lengthCm.Value); } /// @@ -162,8 +159,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.LengthCm.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCm.Value); + writer.WriteNumber("lengthCm", banana.LengthCm); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index 46f6f565bb68..20d095383d78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, Option sweet = default) + public BananaReq(decimal lengthCm, bool sweet) { LengthCm = lengthCm; Sweet = sweet; @@ -56,7 +55,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public Option Sweet { get; set; } + public bool Sweet { get; set; } /// /// Returns the string presentation of the object @@ -105,8 +104,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; - Option sweet = default; + decimal? lengthCm = default; + bool? sweet = default; while (utf8JsonReader.Read()) { @@ -125,11 +124,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = utf8JsonReader.GetBoolean(); break; default: break; @@ -137,19 +136,13 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!lengthCm.IsSet) - throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + if (sweet == null) + throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); - if (sweet.Value == null) - throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - - decimal lengthCmParsedValue = lengthCm.Value.Value; - Option sweetParsedValue = new Option(sweet.Value.Value); - - return new BananaReq(lengthCmParsedValue, sweetParsedValue); + return new BananaReq(lengthCm.Value, sweet.Value); } /// @@ -176,8 +169,8 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) - writer.WriteBoolean("sweet", bananaReq.Sweet.Value); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + writer.WriteBoolean("sweet", bananaReq.Sweet); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 5ec466600efb..87c83d423c17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,7 +102,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -129,15 +128,10 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - - string classNameParsedValue = className.Value; - - return new BasquePig(classNameParsedValue); + return new BasquePig(className); } /// @@ -164,9 +158,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - if (basquePig.ClassName == null) - throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index caf775042ee2..53520c57a3d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -41,7 +40,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -59,37 +58,37 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public Option ATT_NAME { get; set; } + public string ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public Option CapitalCamel { get; set; } + public string CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public Option CapitalSnake { get; set; } + public string CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public Option SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public Option SmallCamel { get; set; } + public string SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public Option SmallSnake { get; set; } + public string SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -149,12 +148,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option aTTNAME = default; - Option capitalCamel = default; - Option capitalSnake = default; - Option sCAETHFlowPoints = default; - Option smallCamel = default; - Option smallSnake = default; + string? aTTNAME = default; + string? capitalCamel = default; + string? capitalSnake = default; + string? sCAETHFlowPoints = default; + string? smallCamel = default; + string? smallSnake = default; while (utf8JsonReader.Read()) { @@ -172,22 +171,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = new Option(utf8JsonReader.GetString()!); + aTTNAME = utf8JsonReader.GetString(); break; case "CapitalCamel": - capitalCamel = new Option(utf8JsonReader.GetString()!); + capitalCamel = utf8JsonReader.GetString(); break; case "Capital_Snake": - capitalSnake = new Option(utf8JsonReader.GetString()!); + capitalSnake = utf8JsonReader.GetString(); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); + sCAETHFlowPoints = utf8JsonReader.GetString(); break; case "smallCamel": - smallCamel = new Option(utf8JsonReader.GetString()!); + smallCamel = utf8JsonReader.GetString(); break; case "small_Snake": - smallSnake = new Option(utf8JsonReader.GetString()!); + smallSnake = utf8JsonReader.GetString(); break; default: break; @@ -195,32 +194,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME.Value == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + if (aTTNAME == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); - if (capitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + if (capitalCamel == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); - if (capitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + if (capitalSnake == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); - if (sCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + if (sCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); - if (smallCamel.Value == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + if (smallCamel == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); - if (smallSnake.Value == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + if (smallSnake == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); - Option aTTNAMEParsedValue = new Option(aTTNAME.Value); - Option capitalCamelParsedValue = new Option(capitalCamel.Value); - Option capitalSnakeParsedValue = new Option(capitalSnake.Value); - Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); - Option smallCamelParsedValue = new Option(smallCamel.Value); - Option smallSnakeParsedValue = new Option(smallSnake.Value); - - return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -247,31 +239,12 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - if (capitalization.ATT_NAME.Value == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); - - if (capitalization.CapitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); - - if (capitalization.CapitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); - - if (capitalization.SCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); - - if (capitalization.SmallCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); - - if (capitalization.SmallSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value); + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + writer.WriteString("smallCamel", capitalization.SmallCamel); + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 2bd9444d3231..2a0960e3a903 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, bool declawed, string color = @"red") : base(className, color) { Declawed = declawed; OnCreated(); @@ -50,7 +49,7 @@ public Cat(string className, Option declawed = default, Option col /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public Option Declawed { get; set; } + public bool Declawed { get; set; } /// /// Returns the string presentation of the object @@ -89,9 +88,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option declawed = default; - Option color = default; + string? className = default; + bool? declawed = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -109,14 +108,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = utf8JsonReader.GetBoolean(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -124,23 +123,16 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Cat.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + if (declawed == null) + throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); - if (declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - - string classNameParsedValue = className.Value; - Option declawedParsedValue = new Option(declawed.Value.Value); - Option colorParsedValue = new Option(color.Value); - - return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); + return new Cat(className, declawed.Value, color); } /// @@ -167,15 +159,9 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - if (cat.ClassName == null) - throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); - - if (cat.Color.Value == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - - writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value); + writer.WriteString("className", cat.ClassName); + writer.WriteBoolean("declawed", cat.Declawed); + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index f63a3d7822b0..714575af8f4d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,29 +33,29 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(long id, string name = @"default-name") { - Name = name; Id = id; + Name = name; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Name + /// Gets or Sets Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long Id { get; set; } /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public Option Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -72,8 +71,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -112,8 +111,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option id = default; + long? id = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -130,12 +129,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); break; default: break; @@ -143,19 +142,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Category.", nameof(name)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - string nameParsedValue = name.Value; - Option idParsedValue = new Option(id.Value.Value); - - return new Category(nameParsedValue, idParsedValue); + return new Category(id.Value, name); } /// @@ -182,11 +175,8 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - - writer.WriteString("name", category.Name); if (category.Id.IsSet) - writer.WriteNumber("id", category.Id.Value); + writer.WriteNumber("id", category.Id); + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index cf6b531aaf76..36f89e4c7930 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) + public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) { Name = name; PetType = petType; @@ -92,6 +91,7 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { + if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -102,13 +102,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new Option PetType { get; set; } + public new PetTypeEnum PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Returns the string presentation of the object @@ -148,8 +148,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option petType = default; + string? name = default; + ChildCat.PetTypeEnum? petType = default; while (utf8JsonReader.Read()) { @@ -167,12 +167,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - if (petTypeRawValue != null) - petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + petType = petTypeRawValue == null + ? null + : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); break; default: break; @@ -180,16 +181,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); - Option nameParsedValue = new Option(name.Value); - Option petTypeParsedValue = new Option(petType.Value.Value); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); - return new ChildCat(nameParsedValue, petTypeParsedValue); + return new ChildCat(name, petType.Value); } /// @@ -216,11 +214,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - if (childCat.Name.Value == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + writer.WriteString("name", childCat.Name); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 9ed3c6423d1c..66a7dee91d88 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(Option varClass = default) + public ClassModel(string varClass) { VarClass = varClass; OnCreated(); @@ -48,7 +47,7 @@ public ClassModel(Option varClass = default) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; + string? varClass = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); - Option varClassParsedValue = new Option(varClass.Value); - - return new ClassModel(varClassParsedValue); + return new ClassModel(varClass); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - if (classModel.VarClass.Value == null) - throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); - - if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value); + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 8a22ca5f372b..01f2390005d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,8 +111,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string? quadrilateralType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -131,10 +130,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -142,22 +141,13 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new ComplexQuadrilateral(quadrilateralType, shapeType); } /// @@ -184,13 +174,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (complexQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); - - if (complexQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index 8699f7daf334..fd9ee9d36830 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,7 +102,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -129,15 +128,10 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - - string classNameParsedValue = className.Value; - - return new DanishPig(classNameParsedValue); + return new DanishPig(className); } /// @@ -164,9 +158,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - if (danishPig.ClassName == null) - throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index a80063846632..6a9c5d4a7952 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(Option dateOnlyProperty = default) + public DateOnlyClass(DateTime dateOnlyProperty) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -49,7 +48,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public Option DateOnlyProperty { get; set; } + public DateTime DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -109,7 +108,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateOnlyProperty = default; + DateTime? dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -128,7 +127,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -136,12 +135,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty.Value == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + if (dateOnlyProperty == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); - Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); - - return new DateOnlyClass(dateOnlyPropertyParsedValue); + return new DateOnlyClass(dateOnlyProperty.Value); } /// @@ -168,8 +165,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 19468560680b..84ebd0792c33 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(Option name = default) + public DeprecatedObject(string name) { Name = name; OnCreated(); @@ -48,7 +47,7 @@ public DeprecatedObject(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); - Option nameParsedValue = new Option(name.Value); - - return new DeprecatedObject(nameParsedValue); + return new DeprecatedObject(name); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - if (deprecatedObject.Name.Value == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); - - if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value); + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 9c1c30c46a56..fa2bab080244 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,11 +33,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// className /// breed + /// className /// color (default to "red") [JsonConstructor] - public Dog(string className, Option breed = default, Option color = default) : base(className, color) + public Dog(string breed, string className, string color = @"red") : base(className, color) { Breed = breed; OnCreated(); @@ -50,7 +49,7 @@ public Dog(string className, Option breed = default, Option colo /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public Option Breed { get; set; } + public string Breed { get; set; } /// /// Returns the string presentation of the object @@ -89,9 +88,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option breed = default; - Option color = default; + string? breed = default; + string? className = default; + string? color = default; while (utf8JsonReader.Read()) { @@ -108,14 +107,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "className": - className = new Option(utf8JsonReader.GetString()!); - break; case "breed": - breed = new Option(utf8JsonReader.GetString()!); + breed = utf8JsonReader.GetString(); + break; + case "className": + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -123,23 +122,16 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Dog.", nameof(className)); + if (breed == null) + throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (breed.Value == null) - throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - - string classNameParsedValue = className.Value; - Option breedParsedValue = new Option(breed.Value); - Option colorParsedValue = new Option(color.Value); - - return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); + return new Dog(breed, className, color); } /// @@ -166,18 +158,9 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - if (dog.ClassName == null) - throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); - - if (dog.Breed.Value == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); - - if (dog.Color.Value == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - - writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value); + writer.WriteString("breed", dog.Breed); + writer.WriteString("className", dog.ClassName); + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 683ea15d0701..8f5fff0f79a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -54,25 +53,25 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Option MainShape { get; set; } + public Shape MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public Option> Shapes { get; set; } + public List Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public Option NullableShape { get; set; } + public NullableShape? NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public Option ShapeOrNull { get; set; } + public ShapeOrNull? ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -141,10 +140,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option mainShape = default; - Option?> shapes = default; - Option nullableShape = default; - Option shapeOrNull = default; + Shape? mainShape = default; + List? shapes = default; + NullableShape? nullableShape = default; + ShapeOrNull? shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -163,19 +162,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -183,16 +182,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape.Value == null) - throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + if (mainShape == null) + throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); - if (shapes.Value == null) - throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + if (shapes == null) + throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); - Option mainShapeParsedValue = new Option(mainShape.Value); - Option> shapesParsedValue = new Option>(shapes.Value); - - return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -219,34 +215,14 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - if (drawing.MainShape.Value == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); - - if (drawing.Shapes.Value == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - - if (drawing.MainShape.IsSet) - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.Shapes.IsSet) - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShape.IsSet) - if (drawing.NullableShape.Value != null) - { - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - } - else - writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNull.IsSet) - if (drawing.ShapeOrNull.Value != null) - { - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); - } - else - writer.WriteNull("shapeOrNull"); + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index 2364179c0559..c9a92f18c9fc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -103,6 +102,7 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { + if (value == ArrayEnumEnum.Fish) return "fish"; @@ -169,6 +169,7 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -182,13 +183,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public Option JustSymbol { get; set; } + public JustSymbolEnum JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public Option> ArrayEnum { get; set; } + public List ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -244,8 +245,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayEnum = default; - Option justSymbol = default; + List? arrayEnum = default; + EnumArrays.JustSymbolEnum? justSymbol = default; while (utf8JsonReader.Read()) { @@ -264,12 +265,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); - if (justSymbolRawValue != null) - justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + justSymbol = justSymbolRawValue == null + ? null + : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); break; default: break; @@ -277,16 +279,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum.Value == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - - if (justSymbol.Value == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + if (arrayEnum == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); - Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); - Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + if (justSymbol == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); - return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); + return new EnumArrays(arrayEnum, justSymbol.Value); } /// @@ -313,13 +312,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - if (enumArrays.ArrayEnum.Value == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - if (enumArrays.ArrayEnum.IsSet) - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs index 03b2780c4842..76dcba15b394 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 7d03b65dc840..ac3f81f956ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,23 +33,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString + /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) { - EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; + EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -60,162 +59,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Defines EnumInteger /// @@ -279,7 +122,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public Option EnumInteger { get; set; } + public EnumIntegerEnum EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -344,7 +187,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public Option EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -403,6 +246,7 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -416,7 +260,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public Option EnumNumber { get; set; } + public EnumNumberEnum EnumNumber { get; set; } /// /// Defines EnumString @@ -541,6 +385,7 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// public static string EnumStringEnumToJsonValue(EnumStringEnum value) { + if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -572,31 +417,188 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public Option EnumString { get; set; } + public EnumStringEnum EnumString { get; set; } + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public Option OuterEnumDefaultValue { get; set; } + public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public Option OuterEnumInteger { get; set; } + public OuterEnumInteger OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public Option OuterEnumIntegerDefaultValue { get; set; } + public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public Option OuterEnum { get; set; } + public OuterEnum? OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -612,11 +614,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -659,15 +661,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option enumStringRequired = default; - Option enumInteger = default; - Option enumIntegerOnly = default; - Option enumNumber = default; - Option enumString = default; - Option outerEnumDefaultValue = default; - Option outerEnumInteger = default; - Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; + EnumTest.EnumIntegerEnum? enumInteger = default; + EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; + EnumTest.EnumNumberEnum? enumNumber = default; + EnumTest.EnumStringEnum? enumString = default; + EnumTest.EnumStringRequiredEnum? enumStringRequired = default; + OuterEnumDefaultValue? outerEnumDefaultValue = default; + OuterEnumInteger? outerEnumInteger = default; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; + OuterEnum? outerEnum = default; while (utf8JsonReader.Read()) { @@ -684,47 +686,53 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - if (enumStringRequiredRawValue != null) - enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); - break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - if (enumStringRawValue != null) - enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + enumString = enumStringRawValue == null + ? null + : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); + break; + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + enumStringRequired = enumStringRequiredRawValue == null + ? null + : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumDefaultValueRawValue != null) - outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + outerEnumDefaultValue = outerEnumDefaultValueRawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerRawValue != null) - outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + outerEnumInteger = outerEnumIntegerRawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerDefaultValueRawValue != null) - outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + outerEnum = outerEnumRawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); break; default: break; @@ -732,43 +740,31 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!enumStringRequired.IsSet) - throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - - if (enumStringRequired.Value == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + if (enumInteger == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); - if (enumInteger.Value == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + if (enumIntegerOnly == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); - if (enumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + if (enumNumber == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); - if (enumNumber.Value == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + if (enumString == null) + throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); - if (enumString.Value == null) - throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + if (enumStringRequired == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (outerEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); - if (outerEnumInteger.Value == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + if (outerEnumInteger == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); - if (outerEnumIntegerDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumIntegerDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); - EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; - Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); - Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); - Option enumNumberParsedValue = new Option(enumNumber.Value.Value); - Option enumStringParsedValue = new Option(enumString.Value.Value); - Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); - Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); - Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); - - return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); + return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); } /// @@ -795,44 +791,44 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); + else + writer.WriteNull("enum_string"); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - if (enumTest.OuterEnumDefaultValue.IsSet) - { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + if (outerEnumDefaultValueRawValue != null) writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - } - if (enumTest.OuterEnumInteger.IsSet) - { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - } - if (enumTest.OuterEnumIntegerDefaultValue.IsSet) + else + writer.WriteNull("outerEnumDefaultValue"); + + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + + if (enumTest.OuterEnum == null) + writer.WriteNull("outerEnum"); + else { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); - } - if (enumTest.OuterEnum.IsSet) - if (enumTest.OuterEnum.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); + if (outerEnumRawValue != null) writer.WriteString("outerEnum", outerEnumRawValue); - } else writer.WriteNull("outerEnum"); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index aa64d55bc195..717de0e356f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,8 +111,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -131,10 +130,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -142,22 +141,13 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new EquilateralTriangle(shapeType, triangleType); } /// @@ -184,13 +174,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (equilateralTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); - - if (equilateralTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - - writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index cb6214ed3f0a..f0e27f10fa32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(Option sourceURI = default) + public File(string sourceURI) { SourceURI = sourceURI; OnCreated(); @@ -49,7 +48,7 @@ public File(Option sourceURI = default) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public Option SourceURI { get; set; } + public string SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +103,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option sourceURI = default; + string? sourceURI = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = new Option(utf8JsonReader.GetString()!); + sourceURI = utf8JsonReader.GetString(); break; default: break; @@ -130,12 +129,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI.Value == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + if (sourceURI == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); - Option sourceURIParsedValue = new Option(sourceURI.Value); - - return new File(sourceURIParsedValue); + return new File(sourceURI); } /// @@ -162,11 +159,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - if (file.SourceURI.Value == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); - - if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value); + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 9d370fa10baa..da341a59421b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(Option file = default, Option> files = default) + public FileSchemaTestClass(File file, List files) { File = file; Files = files; @@ -50,13 +49,13 @@ public FileSchemaTestClass(Option file = default, Option> files /// Gets or Sets File /// [JsonPropertyName("file")] - public Option File { get; set; } + public File File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public Option> Files { get; set; } + public List Files { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option file = default; - Option?> files = default; + File? file = default; + List? files = default; while (utf8JsonReader.Read()) { @@ -132,11 +131,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -144,16 +143,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file.Value == null) - throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + if (file == null) + throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); - if (files.Value == null) - throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + if (files == null) + throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); - Option fileParsedValue = new Option(file.Value); - Option> filesParsedValue = new Option>(files.Value); - - return new FileSchemaTestClass(fileParsedValue, filesParsedValue); + return new FileSchemaTestClass(file, files); } /// @@ -180,18 +176,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - if (fileSchemaTestClass.File.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.Files.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.File.IsSet) - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.Files.IsSet) - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index 59eb60db9853..3628416eb0d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(Option bar = default) + public Foo(string bar = @"bar") { Bar = bar; OnCreated(); @@ -48,7 +47,7 @@ public Foo(Option bar = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; set; } + public string Bar { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; + string? bar = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); - Option barParsedValue = new Option(bar.Value); - - return new Foo(barParsedValue); + return new Foo(bar); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - if (foo.Bar.Value == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); - - if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value); + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c18d6afa90e8..6f2670034f24 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Option varString = default) + public FooGetDefaultResponse(Foo varString) { VarString = varString; OnCreated(); @@ -48,7 +47,7 @@ public FooGetDefaultResponse(Option varString = default) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public Foo VarString { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varString = default; + Foo? varString = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -130,12 +129,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); - Option varStringParsedValue = new Option(varString.Value); - - return new FooGetDefaultResponse(varStringParsedValue); + return new FooGetDefaultResponse(varString); } /// @@ -162,12 +159,8 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - if (fooGetDefaultResponse.VarString.Value == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - - if (fooGetDefaultResponse.VarString.IsSet) - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 6db9c1aac458..9066cc903b6a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,11 +33,9 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// binary /// varByte /// date - /// number - /// password - /// binary /// dateTime /// varDecimal /// varDouble @@ -46,6 +43,8 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer + /// number + /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -54,13 +53,11 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) { + Binary = binary; VarByte = varByte; Date = date; - Number = number; - Password = password; - Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -68,6 +65,8 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password Int32 = int32; Int64 = int64; Integer = integer; + Number = number; + Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -80,6 +79,12 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password partial void OnCreated(); + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get; set; } + /// /// Gets or Sets VarByte /// @@ -93,112 +98,106 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password [JsonPropertyName("date")] public DateTime Date { get; set; } - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } - - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public Option Binary { get; set; } - /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public Option VarDecimal { get; set; } + public decimal VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public Option VarDouble { get; set; } + public double VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public Option VarFloat { get; set; } + public float VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public Option Int32 { get; set; } + public int Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public Option Int64 { get; set; } + public long Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public Option Integer { get; set; } + public int Integer { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public Option PatternWithBackslash { get; set; } + public string PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public Option PatternWithDigits { get; set; } + public string PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public Option PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public string VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public Option UnsignedInteger { get; set; } + public uint UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public Option UnsignedLong { get; set; } + public ulong UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets additional properties @@ -214,11 +213,9 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -226,6 +223,8 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -245,122 +244,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - // VarDouble (double) maximum - if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) + if (this.VarDouble > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) + if (this.VarDouble < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) + if (this.VarFloat > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) + if (this.VarFloat < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32.IsSet && this.Int32.Value > (int)200) + if (this.Int32 > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32.IsSet && this.Int32.Value < (int)20) + if (this.Int32 < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer.IsSet && this.Integer.Value > (int)100) + if (this.Integer > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer.IsSet && this.Integer.Value < (int)10) + if (this.Integer < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - if (this.PatternWithBackslash.Value != null) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits.Value != null) { + if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter.Value != null) { + if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString.Value != null) { + if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString.Value).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) + if (this.UnsignedInteger > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) + if (this.UnsignedInteger < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -401,25 +400,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varByte = default; - Option date = default; - Option number = default; - Option password = default; - Option binary = default; - Option dateTime = default; - Option varDecimal = default; - Option varDouble = default; - Option varFloat = default; - Option int32 = default; - Option int64 = default; - Option integer = default; - Option patternWithBackslash = default; - Option patternWithDigits = default; - Option patternWithDigitsAndDelimiter = default; - Option varString = default; - Option unsignedInteger = default; - Option unsignedLong = default; - Option uuid = default; + System.IO.Stream? binary = default; + byte[]? varByte = default; + DateTime? date = default; + DateTime? dateTime = default; + decimal? varDecimal = default; + double? varDouble = default; + float? varFloat = default; + int? int32 = default; + long? int64 = default; + int? integer = default; + decimal? number = default; + string? password = default; + string? patternWithBackslash = default; + string? patternWithDigits = default; + string? patternWithDigitsAndDelimiter = default; + string? varString = default; + uint? unsignedInteger = default; + ulong? unsignedLong = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -436,76 +435,76 @@ 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)!); - break; - case "date": + case "binary": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "number": + case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); - break; - case "password": - password = new Option(utf8JsonReader.GetString()!); + varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "binary": + case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + date = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = utf8JsonReader.GetDouble(); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = (float)utf8JsonReader.GetDouble(); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = utf8JsonReader.GetInt32(); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = utf8JsonReader.GetInt64(); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = utf8JsonReader.GetInt32(); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = utf8JsonReader.GetDecimal(); + break; + case "password": + password = utf8JsonReader.GetString(); break; case "pattern_with_backslash": - patternWithBackslash = new Option(utf8JsonReader.GetString()!); + patternWithBackslash = utf8JsonReader.GetString(); break; case "pattern_with_digits": - patternWithDigits = new Option(utf8JsonReader.GetString()!); + patternWithDigits = utf8JsonReader.GetString(); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); + patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); break; case "string": - varString = new Option(utf8JsonReader.GetString()!); + varString = utf8JsonReader.GetString(); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = utf8JsonReader.GetUInt32(); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = utf8JsonReader.GetUInt64(); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -513,96 +512,64 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (!varByte.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - - if (!date.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - - if (!number.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - - if (!password.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - - if (varByte.Value == null) - throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + if (binary == null) + throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - if (date.Value == null) - throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (number.Value == null) - throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + if (date == null) + throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); - if (binary.Value == null) - throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + if (varDecimal == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + if (varDouble == null) + throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); - if (varDecimal.Value == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); - if (varDouble.Value == null) - throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + if (int32 == null) + throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); - if (varFloat.Value == null) - throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + if (int64 == null) + throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); - if (int32.Value == null) - throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + if (integer == null) + throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); - if (int64.Value == null) - throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + if (number == null) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (integer.Value == null) - throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (patternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); - if (patternWithDigits.Value == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + if (patternWithDigits == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); - if (patternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + if (patternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); - if (unsignedInteger.Value == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + if (unsignedInteger == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); - if (unsignedLong.Value == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + if (unsignedLong == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); - byte[] varByteParsedValue = varByte.Value; - DateTime dateParsedValue = date.Value.Value; - decimal numberParsedValue = number.Value.Value; - string passwordParsedValue = password.Value; - Option binaryParsedValue = new Option(binary.Value); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option varDecimalParsedValue = new Option(varDecimal.Value.Value); - Option varDoubleParsedValue = new Option(varDouble.Value.Value); - Option varFloatParsedValue = new Option(varFloat.Value.Value); - Option int32ParsedValue = new Option(int32.Value.Value); - Option int64ParsedValue = new Option(int64.Value.Value); - Option integerParsedValue = new Option(integer.Value.Value); - Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); - Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); - Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); - Option varStringParsedValue = new Option(varString.Value); - Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); - Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - - return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); + return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); } /// @@ -629,49 +596,28 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.VarByte == null) - throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); - - if (formatTest.Password == null) - throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); - - if (formatTest.Binary.Value == null) - throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); - - if (formatTest.PatternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigits.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - - if (formatTest.VarString.Value == null) - throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); - + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); + writer.WriteNumber("float", formatTest.VarFloat); + writer.WriteNumber("int32", formatTest.Int32); + writer.WriteNumber("int64", formatTest.Int64); + writer.WriteNumber("integer", formatTest.Integer); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + writer.WriteString("string", formatTest.VarString); + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); + writer.WriteString("uuid", formatTest.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 9f734a97b691..c3e213f48a47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color = default) + public Fruit(Apple apple, string color) { Apple = apple; Color = color; @@ -48,7 +47,7 @@ public Fruit(Apple apple, Option color = default) /// /// /// color - public Fruit(Banana banana, Option color = default) + public Fruit(Banana banana, string color) { Banana = banana; Color = color; @@ -71,7 +70,7 @@ public Fruit(Banana banana, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -119,7 +118,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -159,7 +158,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -167,16 +166,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - - Option colorParsedValue = new Option(color.Value); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); if (apple != null) - return new Fruit(apple, colorParsedValue); + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, colorParsedValue); + return new Fruit(banana, color); throw new JsonException(); } @@ -205,11 +202,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs index 46c3c3b25407..56212b9c18dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 600018e5f77f..9ed8b2db2d15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Option apple, Option banana, Option color = default) + public GmFruit(Apple? apple, Banana? banana, string color) { Apple = apple; Banana = banana; @@ -50,18 +49,18 @@ public GmFruit(Option apple, Option banana, Option colo /// /// Gets or Sets Apple /// - public Option Apple { get; set; } + public Apple? Apple { get; set; } /// /// Gets or Sets Banana /// - public Option Banana { get; set; } + public Banana? Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -109,7 +108,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -149,7 +148,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -157,15 +156,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); - Option colorParsedValue = new Option(color.Value); - - Option appleParsedValue = new Option(apple); - Option bananaParsedValue = new Option(banana); - - return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); + return new GmFruit(apple, banana, color); } /// @@ -179,16 +173,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) + if (gmFruit.Apple != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); } - if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) + if (gmFruit.Banana != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -204,11 +198,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - if (gmFruit.Color.Value == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); - - if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value); + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 5c2b20cd6e73..cb7fe43f91cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -113,7 +112,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string? petType = default; while (utf8JsonReader.Read()) { @@ -131,7 +130,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()!); + petType = utf8JsonReader.GetString(); break; default: break; @@ -139,15 +138,10 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - - string petTypeParsedValue = petType.Value; - - return new GrandparentAnimal(petTypeParsedValue); + return new GrandparentAnimal(petType); } /// @@ -174,9 +168,6 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - if (grandparentAnimal.PetType == null) - throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 787c486f2f99..3b8c651908c8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(Option bar = default, Option foo = default) + internal HasOnlyReadOnly(string bar, string foo) { Bar = bar; Foo = foo; @@ -50,13 +49,13 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public Option Foo { get; } + public string Foo { get; } /// /// Gets or Sets additional properties @@ -149,8 +148,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option foo = default; + string? bar = default; + string? foo = default; while (utf8JsonReader.Read()) { @@ -168,10 +167,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; case "foo": - foo = new Option(utf8JsonReader.GetString()!); + foo = utf8JsonReader.GetString(); break; default: break; @@ -179,16 +178,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); - if (foo.Value == null) - throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + if (foo == null) + throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); - Option barParsedValue = new Option(bar.Value); - Option fooParsedValue = new Option(foo.Value); - - return new HasOnlyReadOnly(barParsedValue, fooParsedValue); + return new HasOnlyReadOnly(bar, foo); } /// @@ -215,15 +211,8 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - if (hasOnlyReadOnly.Bar.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Foo.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); + writer.WriteString("bar", hasOnlyReadOnly.Bar); + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 01dce6e04e4a..ccdc21a06856 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(Option nullableMessage = default) + public HealthCheckResult(string? nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -48,7 +47,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public Option NullableMessage { get; set; } + public string? NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option nullableMessage = default; + string? nullableMessage = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = new Option(utf8JsonReader.GetString()); + nullableMessage = utf8JsonReader.GetString(); break; default: break; @@ -156,11 +155,7 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - if (healthCheckResult.NullableMessage.IsSet) - if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); - else - writer.WriteNull("NullableMessage"); + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 319db47dfc02..f33f99e6dfbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -105,8 +104,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -124,10 +123,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -135,22 +134,13 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new IsoscelesTriangle(shapeType, triangleType); } /// @@ -177,13 +167,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (isoscelesTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); - - if (isoscelesTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index 7d80e50a7245..8f55db6ee70d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(Option var123List = default) + public List(string var123List) { Var123List = var123List; OnCreated(); @@ -48,7 +47,7 @@ public List(Option var123List = default) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public Option Var123List { get; set; } + public string Var123List { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option var123List = default; + string? var123List = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = new Option(utf8JsonReader.GetString()!); + var123List = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List.Value == null) - throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + if (var123List == null) + throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); - Option var123ListParsedValue = new Option(var123List.Value); - - return new List(var123ListParsedValue); + return new List(var123List); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - if (list.Var123List.Value == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); - - if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value); + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 2ede9b4c0484..8253e7ac7bc8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -50,13 +49,13 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public Option EscapedLiteralString { get; set; } + public string EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public Option UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option escapedLiteralString = default; - Option unescapedLiteralString = default; + string? escapedLiteralString = default; + string? unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -131,10 +130,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = new Option(utf8JsonReader.GetString()!); + escapedLiteralString = utf8JsonReader.GetString(); break; case "unescapedLiteralString": - unescapedLiteralString = new Option(utf8JsonReader.GetString()!); + unescapedLiteralString = utf8JsonReader.GetString(); break; default: break; @@ -142,16 +141,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); - if (unescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); - Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); - Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); - - return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -178,15 +174,8 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - if (literalStringClass.EscapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.UnescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index e861f1c1432c..0910cbbb0a17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -153,7 +152,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; Pig? pig = null; Whale? whale = null; @@ -210,7 +209,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -218,22 +217,17 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Mammal.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); if (pig != null) - return new Mammal(pig, classNameParsedValue); + return new Mammal(pig, className); if (whale != null) - return new Mammal(whale, classNameParsedValue); + return new Mammal(whale, className); if (zebra != null) - return new Mammal(zebra, classNameParsedValue); + return new Mammal(zebra, className); throw new JsonException(); } @@ -277,9 +271,6 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - if (mammal.ClassName == null) - throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index 41a63a364d45..e5442a41c590 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) { DirectMap = directMap; IndirectMap = indirectMap; @@ -107,6 +106,7 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { + if (value == InnerEnum.UPPER) return "UPPER"; @@ -120,25 +120,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Option> DirectMap { get; set; } + public Dictionary DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Option> IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Option>> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Option> MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -196,10 +196,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> directMap = default; - Option?> indirectMap = default; - Option>?> mapMapOfString = default; - Option?> mapOfEnumString = default; + Dictionary? directMap = default; + Dictionary? indirectMap = default; + Dictionary>? mapMapOfString = default; + Dictionary? mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -218,19 +218,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -238,24 +238,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap.Value == null) - throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - - if (indirectMap.Value == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + if (directMap == null) + throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); - if (mapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + if (indirectMap == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); - if (mapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + if (mapMapOfString == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); - Option> directMapParsedValue = new Option>(directMap.Value); - Option> indirectMapParsedValue = new Option>(indirectMap.Value); - Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); - Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + if (mapOfEnumString == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); - return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -282,30 +277,14 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - if (mapTest.DirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); - - if (mapTest.IndirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); - - if (mapTest.MapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); - - if (mapTest.MapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - - if (mapTest.DirectMap.IsSet) - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMap.IsSet) - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfString.IsSet) - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumString.IsSet) - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 738bf4ec11d0..2ea2d79b05d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) { DateTime = dateTime; Map = map; @@ -54,25 +53,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = d /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Option> Map { get; set; } + public Dictionary Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Option UuidWithPattern { get; set; } + public Guid UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -106,7 +105,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -141,10 +140,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateTime = default; - Option?> map = default; - Option uuid = default; - Option uuidWithPattern = default; + DateTime? dateTime = default; + Dictionary? map = default; + Guid? uuid = default; + Guid? uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -163,19 +162,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = utf8JsonReader.GetGuid(); break; default: break; @@ -183,24 +182,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map.Value == null) - throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map == null) + throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern.Value == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option> mapParsedValue = new Option>(map.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); - - return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); } /// @@ -227,16 +221,11 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index 064b13b50785..b017d0715831 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(Option varClass = default, Option name = default) + public Model200Response(string varClass, int name) { VarClass = varClass; Name = name; @@ -50,13 +49,13 @@ public Model200Response(Option varClass = default, Option name = de /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public int Name { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; - Option name = default; + string? varClass = default; + int? name = default; while (utf8JsonReader.Read()) { @@ -131,11 +130,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = new Option(utf8JsonReader.GetString()!); + varClass = utf8JsonReader.GetString(); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = utf8JsonReader.GetInt32(); break; default: break; @@ -143,16 +142,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); - Option varClassParsedValue = new Option(varClass.Value); - Option nameParsedValue = new Option(name.Value.Value); - - return new Model200Response(varClassParsedValue, nameParsedValue); + return new Model200Response(varClass, name.Value); } /// @@ -179,12 +175,8 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - if (model200Response.VarClass.Value == null) - throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) - writer.WriteNumber("name", model200Response.Name.Value); + writer.WriteString("class", model200Response.VarClass); + writer.WriteNumber("name", model200Response.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 5fcd1fcca67d..1883e1d09c88 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(Option varClient = default) + public ModelClient(string varClient) { VarClient = varClient; OnCreated(); @@ -48,7 +47,7 @@ public ModelClient(Option varClient = default) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public Option VarClient { get; set; } + public string VarClient { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClient = default; + string? varClient = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = new Option(utf8JsonReader.GetString()!); + varClient = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient.Value == null) - throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + if (varClient == null) + throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); - Option varClientParsedValue = new Option(varClient.Value); - - return new ModelClient(varClientParsedValue); + return new ModelClient(varClient); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - if (modelClient.VarClient.Value == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); - - if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value); + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 30cd71df5194..83161d26894d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + public Name(int varName, string property, int snakeCase, int var123Number) { VarName = varName; Property = property; @@ -60,19 +59,19 @@ public Name(int varName, Option property = default, Option snakeCas /// Gets or Sets Property /// [JsonPropertyName("property")] - public Option Property { get; set; } + public string Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public Option SnakeCase { get; } + public int SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public Option Var123Number { get; } + public int Var123Number { get; } /// /// Gets or Sets additional properties @@ -167,10 +166,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varName = default; - Option property = default; - Option snakeCase = default; - Option var123Number = default; + int? varName = default; + string? property = default; + int? snakeCase = default; + int? var123Number = default; while (utf8JsonReader.Read()) { @@ -189,18 +188,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = utf8JsonReader.GetInt32(); break; case "property": - property = new Option(utf8JsonReader.GetString()!); + property = utf8JsonReader.GetString(); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = utf8JsonReader.GetInt32(); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = utf8JsonReader.GetInt32(); break; default: break; @@ -208,27 +207,19 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!varName.IsSet) - throw new ArgumentException("Property is required for class Name.", nameof(varName)); + if (varName == null) + throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (varName.Value == null) - throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + if (property == null) + throw new ArgumentNullException(nameof(property), "Property is required for class Name."); - if (property.Value == null) - throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + if (snakeCase == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); - if (snakeCase.Value == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + if (var123Number == null) + throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); - if (var123Number.Value == null) - throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - - int varNameParsedValue = varName.Value.Value; - Option propertyParsedValue = new Option(property.Value); - Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); - Option var123NumberParsedValue = new Option(var123Number.Value.Value); - - return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); + return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); } /// @@ -255,13 +246,10 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - if (name.Property.Value == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - - writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) - writer.WriteNumber("123Number", name.Var123Number.Value); + writer.WriteNumber("name", name.VarName); + writer.WriteString("property", name.Property); + writer.WriteNumber("snake_case", name.SnakeCase); + writer.WriteNumber("123Number", name.Var123Number); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 1159c715cd41..23f7775d8909 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,8 +111,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>?> aObjVariableobject = default; - Option pkiNotificationtestID = default; + List>? aObjVariableobject = default; + int? pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -132,11 +131,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); + aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = utf8JsonReader.GetInt32(); break; default: break; @@ -144,22 +143,13 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (!aObjVariableobject.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + if (aObjVariableobject == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (!pkiNotificationtestID.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + if (pkiNotificationtestID == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (aObjVariableobject.Value == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - if (pkiNotificationtestID.Value == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - List> aObjVariableobjectParsedValue = aObjVariableobject.Value; - int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; - - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); } /// @@ -186,9 +176,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { - if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) - throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 7d4c243525a3..916746334975 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +46,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -70,73 +69,73 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonPropertyName("array_items_nullable")] - public Option> ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Option> ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public Option?> ArrayAndItemsNullableProp { get; set; } + public List? ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public Option?> ArrayNullableProp { get; set; } + public List? ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public Option BooleanProp { get; set; } + public bool? BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public Option DateProp { get; set; } + public DateTime? DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public Option DatetimeProp { get; set; } + public DateTime? DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public Option IntegerProp { get; set; } + public int? IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public Option NumberProp { get; set; } + public decimal? NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Option?> ObjectAndItemsNullableProp { get; set; } + public Dictionary? ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Option?> ObjectNullableProp { get; set; } + public Dictionary? ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public Option StringProp { get; set; } + public string? StringProp { get; set; } /// /// Gets or Sets additional properties @@ -223,18 +222,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayItemsNullable = default; - Option?> objectItemsNullable = default; - Option?> arrayAndItemsNullableProp = default; - Option?> arrayNullableProp = default; - Option booleanProp = default; - Option dateProp = default; - Option datetimeProp = default; - Option integerProp = default; - Option numberProp = default; - Option?> objectAndItemsNullableProp = default; - Option?> objectNullableProp = default; - Option stringProp = default; + List? arrayItemsNullable = default; + Dictionary? objectItemsNullable = default; + List? arrayAndItemsNullableProp = default; + List? arrayNullableProp = default; + bool? booleanProp = default; + DateTime? dateProp = default; + DateTime? datetimeProp = default; + int? integerProp = default; + decimal? numberProp = default; + Dictionary? objectAndItemsNullableProp = default; + Dictionary? objectNullableProp = default; + string? stringProp = default; while (utf8JsonReader.Read()) { @@ -253,50 +252,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = utf8JsonReader.GetBoolean(); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = utf8JsonReader.GetInt32(); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = utf8JsonReader.GetDecimal(); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "string_prop": - stringProp = new Option(utf8JsonReader.GetString()); + stringProp = utf8JsonReader.GetString(); break; default: break; @@ -304,16 +303,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + if (arrayItemsNullable == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); - if (objectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + if (objectItemsNullable == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); - Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); - Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); - - return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -340,75 +336,45 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableClass.ArrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ObjectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ArrayItemsNullable.IsSet) - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullable.IsSet) - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullableProp.IsSet) - if (nullableClass.ArrayAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullableProp.IsSet) - if (nullableClass.ArrayNullableProp.Value != null) - { - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) - if (nullableClass.ObjectAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullableProp.IsSet) - if (nullableClass.ObjectNullableProp.Value != null) - { - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else - writer.WriteNull("string_prop"); + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + + if (nullableClass.BooleanProp != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DateProp != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimeProp != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerProp != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberProp != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); + else + writer.WriteNull("number_prop"); + + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 766d377df021..b5d1bc4e4200 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Option uuid = default) + public NullableGuidClass(Guid? uuid = default) { Uuid = uuid; OnCreated(); @@ -49,7 +48,7 @@ public NullableGuidClass(Option uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid? Uuid { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +103,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option uuid = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -123,7 +122,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -158,11 +157,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid.IsSet) - if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); - else - writer.WriteNull("uuid"); + + if (nullableGuidClass.Uuid == null) + writer.WriteNull("uuid"); + else + writer.WriteString("uuid", nullableGuidClass.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index 02a1e7ed5502..c6f4dea35852 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -136,7 +135,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +186,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -195,19 +194,14 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeTypeParsedValue); + return new NullableShape(quadrilateral, shapeType); if (triangle != null) - return new NullableShape(triangle, shapeTypeParsedValue); + return new NullableShape(triangle, shapeType); throw new JsonException(); } @@ -246,9 +240,6 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - if (nullableShape.ShapeType == null) - throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index cb2cfe945ff7..3e05a1954548 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(Option justNumber = default) + public NumberOnly(decimal justNumber) { JustNumber = justNumber; OnCreated(); @@ -48,7 +47,7 @@ public NumberOnly(Option justNumber = default) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public Option JustNumber { get; set; } + public decimal JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option justNumber = default; + decimal? justNumber = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = utf8JsonReader.GetDecimal(); break; default: break; @@ -130,12 +129,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber.Value == null) - throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + if (justNumber == null) + throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); - Option justNumberParsedValue = new Option(justNumber.Value.Value); - - return new NumberOnly(justNumberParsedValue); + return new NumberOnly(justNumber.Value); } /// @@ -162,8 +159,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (numberOnly.JustNumber.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); + writer.WriteNumber("JustNumber", numberOnly.JustNumber); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 0f690cdf4df3..84957dfb4699 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -55,27 +54,27 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonPropertyName("bars")] [Obsolete] - public Option> Bars { get; set; } + public List Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public Option DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public Option Id { get; set; } + public decimal Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public string Uuid { get; set; } /// /// Gets or Sets additional properties @@ -133,10 +132,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> bars = default; - Option deprecatedRef = default; - Option id = default; - Option uuid = default; + List? bars = default; + DeprecatedObject? deprecatedRef = default; + decimal? id = default; + string? uuid = default; while (utf8JsonReader.Read()) { @@ -155,18 +154,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = utf8JsonReader.GetDecimal(); break; case "uuid": - uuid = new Option(utf8JsonReader.GetString()!); + uuid = utf8JsonReader.GetString(); break; default: break; @@ -174,24 +173,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars.Value == null) - throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (bars == null) + throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); - if (deprecatedRef.Value == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (deprecatedRef == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); - Option> barsParsedValue = new Option>(bars.Value); - Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); - Option idParsedValue = new Option(id.Value.Value); - Option uuidParsedValue = new Option(uuid.Value); - - return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); } /// @@ -218,24 +212,12 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - if (objectWithDeprecatedFields.Bars.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.DeprecatedRef.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Uuid.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Bars.IsSet) - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRef.IsSet) - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs index a0a54c250670..e84b8aae250e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index b97c44c70dfa..4fc1f5cccf39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -41,7 +40,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) { Id = id; PetId = petId; @@ -123,6 +122,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Placed) return "placed"; @@ -140,38 +140,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public Option PetId { get; set; } + public long PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public Option Quantity { get; set; } + public int Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public Option ShipDate { get; set; } + public DateTime ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public Option Complete { get; set; } + public bool Complete { get; set; } /// /// Gets or Sets additional properties @@ -236,12 +236,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option petId = default; - Option quantity = default; - Option shipDate = default; - Option status = default; - Option complete = default; + long? id = default; + long? petId = default; + int? quantity = default; + DateTime? shipDate = default; + Order.StatusEnum? status = default; + bool? complete = default; while (utf8JsonReader.Read()) { @@ -260,28 +260,29 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = utf8JsonReader.GetInt64(); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = utf8JsonReader.GetInt32(); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Order.StatusEnumFromStringOrDefault(statusRawValue); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = utf8JsonReader.GetBoolean(); break; default: break; @@ -289,32 +290,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - - if (petId.Value == null) - throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Order."); - if (quantity.Value == null) - throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + if (petId == null) + throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); - if (shipDate.Value == null) - throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + if (quantity == null) + throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + if (shipDate == null) + throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); - if (complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Order."); - Option idParsedValue = new Option(id.Value.Value); - Option petIdParsedValue = new Option(petId.Value.Value); - Option quantityParsedValue = new Option(quantity.Value.Value); - Option shipDateParsedValue = new Option(shipDate.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option completeParsedValue = new Option(complete.Value.Value); + if (complete == null) + throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); - return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); + return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); } /// @@ -341,18 +335,18 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + writer.WriteNumber("id", order.Id); + writer.WriteNumber("petId", order.PetId); + writer.WriteNumber("quantity", order.Quantity); + writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) - writer.WriteBoolean("complete", order.Complete.Value); + writer.WriteBoolean("complete", order.Complete); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index d2369fb21dd6..944b48cec72f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + public OuterComposite(bool myBoolean, decimal myNumber, string myString) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -52,19 +51,19 @@ public OuterComposite(Option myBoolean = default, Option myNumber /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public Option MyBoolean { get; set; } + public bool MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public Option MyNumber { get; set; } + public decimal MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public Option MyString { get; set; } + public string MyString { get; set; } /// /// Gets or Sets additional properties @@ -121,9 +120,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option myBoolean = default; - Option myNumber = default; - Option myString = default; + bool? myBoolean = default; + decimal? myNumber = default; + string? myString = default; while (utf8JsonReader.Read()) { @@ -142,14 +141,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = utf8JsonReader.GetBoolean(); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = utf8JsonReader.GetDecimal(); break; case "my_string": - myString = new Option(utf8JsonReader.GetString()!); + myString = utf8JsonReader.GetString(); break; default: break; @@ -157,20 +156,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean.Value == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + if (myBoolean == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); - if (myNumber.Value == null) - throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + if (myNumber == null) + throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); - if (myString.Value == null) - throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + if (myString == null) + throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); - Option myBooleanParsedValue = new Option(myBoolean.Value.Value); - Option myNumberParsedValue = new Option(myNumber.Value.Value); - Option myStringParsedValue = new Option(myString.Value); - - return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); + return new OuterComposite(myBoolean.Value, myNumber.Value, myString); } /// @@ -197,13 +192,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - if (outerComposite.MyString.Value == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value); + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); + writer.WriteNumber("my_number", outerComposite.MyNumber); + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs index 96af6f3670d8..01f4f4676274 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index a50d5c056ecc..7903c8296487 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 41ecebcf8f5b..a09978af1c35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 902dbb066392..4a73f8886ac8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 03a8ccdecacd..9a549df1f0aa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 9ae0e661c71f..73fc6e3e5ede 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -79,7 +78,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string? petType = default; while (utf8JsonReader.Read()) { @@ -97,7 +96,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()!); + petType = utf8JsonReader.GetString(); break; default: break; @@ -105,15 +104,10 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - - string petTypeParsedValue = petType.Value; - - return new ParentPet(petTypeParsedValue); + return new ParentPet(petType); } /// @@ -140,9 +134,6 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - if (parentPet.PetType == null) - throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 3be1942e830b..1754664e96da 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,19 +33,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name - /// photoUrls /// category /// id + /// name + /// photoUrls /// pet status in the store /// tags [JsonConstructor] - public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) { - Name = name; - PhotoUrls = photoUrls; Category = category; Id = id; + Name = name; + PhotoUrls = photoUrls; Status = status; Tags = tags; OnCreated(); @@ -123,6 +122,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Available) return "available"; @@ -140,7 +140,19 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long Id { get; set; } /// /// Gets or Sets Name @@ -155,23 +167,11 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Option Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public Option> Tags { get; set; } + public List Tags { get; set; } /// /// Gets or Sets additional properties @@ -187,10 +187,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -231,12 +231,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option?> photoUrls = default; - Option category = default; - Option id = default; - Option status = default; - Option?> tags = default; + Category? category = default; + long? id = default; + string? name = default; + List? photoUrls = default; + Pet.StatusEnum? status = default; + List? tags = default; while (utf8JsonReader.Read()) { @@ -253,29 +253,30 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; - case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Pet.StatusEnumFromStringOrDefault(statusRawValue); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -283,38 +284,25 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(name)); - - if (!photoUrls.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + if (category == null) + throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - if (photoUrls.Value == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - if (category.Value == null) - throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + if (photoUrls == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); - if (tags.Value == null) - throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + if (tags == null) + throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); - string nameParsedValue = name.Value; - List photoUrlsParsedValue = photoUrls.Value; - Option categoryParsedValue = new Option(category.Value); - Option idParsedValue = new Option(id.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option> tagsParsedValue = new Option>(tags.Value); - - return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); + return new Pet(category, id.Value, name, photoUrls, status.Value, tags); } /// @@ -341,33 +329,21 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - if (pet.Name == null) - throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); - - if (pet.PhotoUrls == null) - throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); - - if (pet.Category.Value == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - - if (pet.Tags.Value == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - - writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - if (pet.Category.IsSet) - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.Tags.IsSet) - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index e88caaa7862d..07ecf267e656 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -136,7 +135,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string? className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -187,7 +186,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; default: break; @@ -195,19 +194,14 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Pig.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); if (basquePig != null) - return new Pig(basquePig, classNameParsedValue); + return new Pig(basquePig, className); if (danishPig != null) - return new Pig(danishPig, classNameParsedValue); + return new Pig(danishPig, className); throw new JsonException(); } @@ -246,9 +240,6 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - if (pig.ClassName == null) - throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 1333f4a725d6..2093843c8d9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 933da7c6dce7..2ac725986a2a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -136,7 +135,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string? quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -187,7 +186,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -195,19 +194,14 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); - - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(complexQuadrilateral, quadrilateralType); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType); throw new JsonException(); } @@ -246,9 +240,6 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index b9bfac847eb2..a0be19661249 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,7 +102,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string? quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -129,15 +128,10 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - - return new QuadrilateralInterface(quadrilateralTypeParsedValue); + return new QuadrilateralInterface(quadrilateralType); } /// @@ -164,9 +158,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateralInterface.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index e95e4151a584..7dae6b8bb181 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(Option bar = default, Option baz = default) + public ReadOnlyFirst(string bar, string baz) { Bar = bar; Baz = baz; @@ -50,13 +49,13 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public Option Baz { get; set; } + public string Baz { get; set; } /// /// Gets or Sets additional properties @@ -148,8 +147,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option baz = default; + string? bar = default; + string? baz = default; while (utf8JsonReader.Read()) { @@ -167,10 +166,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()!); + bar = utf8JsonReader.GetString(); break; case "baz": - baz = new Option(utf8JsonReader.GetString()!); + baz = utf8JsonReader.GetString(); break; default: break; @@ -178,16 +177,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); - if (baz.Value == null) - throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + if (baz == null) + throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); - Option barParsedValue = new Option(bar.Value); - Option bazParsedValue = new Option(baz.Value); - - return new ReadOnlyFirst(barParsedValue, bazParsedValue); + return new ReadOnlyFirst(bar, baz); } /// @@ -214,15 +210,8 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - if (readOnlyFirst.Bar.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Baz.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value); + writer.WriteString("bar", readOnlyFirst.Bar); + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 033276d0f3bc..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,2204 +0,0 @@ -// -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -#nullable enable - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - public partial class RequiredClass : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// requiredNotNullableDateProp - /// requiredNotnullableArrayOfString - /// requiredNotnullableBooleanProp - /// requiredNotnullableDatetimeProp - /// requiredNotnullableEnumInteger - /// requiredNotnullableEnumIntegerOnly - /// requiredNotnullableEnumString - /// requiredNotnullableOuterEnumDefaultValue - /// requiredNotnullableStringProp - /// requiredNotnullableUuid - /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid - /// requiredNullableArrayOfString - /// requiredNullableBooleanProp - /// requiredNullableDateProp - /// requiredNullableDatetimeProp - /// requiredNullableEnumInteger - /// requiredNullableEnumIntegerOnly - /// requiredNullableEnumString - /// requiredNullableIntegerProp - /// requiredNullableOuterEnumDefaultValue - /// requiredNullableStringProp - /// requiredNullableUuid - /// notRequiredNullableDateProp - /// notRequiredNullableIntegerProp - /// notrequiredNullableArrayOfString - /// notrequiredNullableBooleanProp - /// notrequiredNullableDatetimeProp - /// notrequiredNullableEnumInteger - /// notrequiredNullableEnumIntegerOnly - /// notrequiredNullableEnumString - /// notrequiredNullableOuterEnumDefaultValue - /// notrequiredNullableStringProp - /// notrequiredNullableUuid - [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) - { - RequiredNotNullableDateProp = requiredNotNullableDateProp; - RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - RequiredNotnullableEnumString = requiredNotnullableEnumString; - RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - RequiredNotnullableStringProp = requiredNotnullableStringProp; - RequiredNotnullableUuid = requiredNotnullableUuid; - RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - RequiredNullableArrayOfString = requiredNullableArrayOfString; - RequiredNullableBooleanProp = requiredNullableBooleanProp; - RequiredNullableDateProp = requiredNullableDateProp; - RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - RequiredNullableEnumInteger = requiredNullableEnumInteger; - RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - RequiredNullableEnumString = requiredNullableEnumString; - RequiredNullableIntegerProp = requiredNullableIntegerProp; - RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - RequiredNullableStringProp = requiredNullableStringProp; - RequiredNullableUuid = requiredNullableUuid; - NotRequiredNullableDateProp = notRequiredNullableDateProp; - NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - NotrequiredNullableEnumString = notrequiredNullableEnumString; - NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - NotrequiredNullableStringProp = notrequiredNullableStringProp; - NotrequiredNullableUuid = notrequiredNullableUuid; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNotnullableEnumString - /// - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) - { - if (value == RequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public Option NotrequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumString - /// - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) - { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public Option NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } - - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNullableEnumString - /// - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [JsonPropertyName("notrequired_nullable_enum_integer")] - public Option NotrequiredNullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public Option NotrequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNullableEnumString - /// - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == NotrequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [JsonPropertyName("notrequired_nullable_enum_string")] - public Option NotrequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public Option NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public Option NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public Option> NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public Option NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public Option NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public Option NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Option NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [JsonPropertyName("not_required_nullable_date_prop")] - public Option NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public Option NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [JsonPropertyName("notrequired_nullable_array_of_string")] - public Option?> NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [JsonPropertyName("notrequired_nullable_boolean_prop")] - public Option NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [JsonPropertyName("notrequired_nullable_datetime_prop")] - public Option NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [JsonPropertyName("notrequired_nullable_string_prop")] - public Option NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_nullable_uuid")] - public Option NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; } = new Dictionary(); - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class RequiredClassJsonConverter : JsonConverter - { - /// - /// The format to use to serialize RequiredNotNullableDateProp - /// - public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNotnullableDatetimeProp - /// - public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize RequiredNullableDateProp - /// - public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNullableDatetimeProp - /// - public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNullableDateProp - /// - public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNullableDatetimeProp - /// - public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option requiredNotNullableDateProp = default; - Option?> requiredNotnullableArrayOfString = default; - Option requiredNotnullableBooleanProp = default; - Option requiredNotnullableDatetimeProp = default; - Option requiredNotnullableEnumInteger = default; - Option requiredNotnullableEnumIntegerOnly = default; - Option requiredNotnullableEnumString = default; - Option requiredNotnullableOuterEnumDefaultValue = default; - Option requiredNotnullableStringProp = default; - Option requiredNotnullableUuid = default; - Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option?> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; - Option?> requiredNullableArrayOfString = default; - Option requiredNullableBooleanProp = default; - Option requiredNullableDateProp = default; - Option requiredNullableDatetimeProp = default; - Option requiredNullableEnumInteger = default; - Option requiredNullableEnumIntegerOnly = default; - Option requiredNullableEnumString = default; - Option requiredNullableIntegerProp = default; - Option requiredNullableOuterEnumDefaultValue = default; - Option requiredNullableStringProp = default; - Option requiredNullableUuid = default; - Option notRequiredNullableDateProp = default; - Option notRequiredNullableIntegerProp = default; - Option?> notrequiredNullableArrayOfString = default; - Option notrequiredNullableBooleanProp = default; - Option notrequiredNullableDatetimeProp = default; - Option notrequiredNullableEnumInteger = default; - Option notrequiredNullableEnumIntegerOnly = default; - Option notrequiredNullableEnumString = default; - Option notrequiredNullableOuterEnumDefaultValue = default; - Option notrequiredNullableStringProp = default; - Option notrequiredNullableUuid = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string? localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)!); - break; - case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_notnullable_enum_string": - string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableEnumStringRawValue != null) - requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); - break; - case "required_notnullable_outerEnumDefaultValue": - string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableOuterEnumDefaultValueRawValue != null) - requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "required_notnullable_string_prop": - requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_string": - string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNullableEnumStringRawValue != null) - requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); - break; - case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "required_nullable_outerEnumDefaultValue": - string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); - break; - case "required_nullable_string_prop": - requiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_nullable_enum_string": - string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableEnumStringRawValue != null) - notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); - break; - case "notrequired_nullable_outerEnumDefaultValue": - string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableOuterEnumDefaultValueRawValue != null) - notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_nullable_string_prop": - notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - default: - break; - } - } - } - - if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); - - if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); - - if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); - - if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); - - if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); - - if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); - - if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); - - if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); - - if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); - - if (!requiredNotnullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); - - if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); - - if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); - - if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); - - if (!requiredNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); - - if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); - - if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); - - if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); - - if (!requiredNullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); - - if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); - - if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); - - if (!requiredNullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); - - if (!requiredNullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); - - if (requiredNotNullableDateProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableDateProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; - List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; - bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; - DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; - RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; - OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; - string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; - Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; - int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; - Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); - Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); - Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); - Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); - Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); - Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); - Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); - Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); - Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); - Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); - Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); - List? requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; - bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; - DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; - DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; - RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; - RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; - RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; - int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; - OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; - string? requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; - Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; - - return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(ref writer, requiredClass, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - if (requiredClass.RequiredNotnullableArrayOfString == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.RequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); - if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); - else - writer.WriteNull("required_notnullable_enum_string"); - - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) - { - writer.WritePropertyName("required_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); - if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); - else - writer.WriteNull("required_nullable_enum_string"); - - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - else - { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); - else - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - } - - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) - if (requiredClass.NotrequiredNullableArrayOfString.Value != null) - { - writer.WritePropertyName("notrequired_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); - if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); - else - writer.WriteNull("notrequired_nullable_enum_string"); - - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) - { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); - writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); - } - else - writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else - writer.WriteNull("notrequired_nullable_uuid"); - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index a667379b94d0..262ecadf740b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(Option varReturn = default) + public Return(int varReturn) { VarReturn = varReturn; OnCreated(); @@ -48,7 +47,7 @@ public Return(Option varReturn = default) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public Option VarReturn { get; set; } + public int VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varReturn = default; + int? varReturn = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = utf8JsonReader.GetInt32(); break; default: break; @@ -130,12 +129,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn.Value == null) - throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + if (varReturn == null) + throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); - Option varReturnParsedValue = new Option(varReturn.Value.Value); - - return new Return(varReturnParsedValue); + return new Return(varReturn.Value); } /// @@ -162,8 +159,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.VarReturn.IsSet) - writer.WriteNumber("return", varReturn.VarReturn.Value); + writer.WriteNumber("return", varReturn.VarReturn); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index c50af5ccb341..f7be23ecece4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(Option role = default, Option roleUuid = default) + public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) { Role = role; RoleUuid = roleUuid; @@ -50,13 +49,13 @@ public RolesReportsHash(Option role = default, Option [JsonPropertyName("role")] - public Option Role { get; set; } + public RolesReportsHashRole Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Option RoleUuid { get; set; } + public Guid RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option role = default; - Option roleUuid = default; + RolesReportsHashRole? role = default; + Guid? roleUuid = default; while (utf8JsonReader.Read()) { @@ -132,11 +131,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = utf8JsonReader.GetGuid(); break; default: break; @@ -144,16 +143,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role.Value == null) - throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + if (role == null) + throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); - if (roleUuid.Value == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + if (roleUuid == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); - Option roleParsedValue = new Option(role.Value); - Option roleUuidParsedValue = new Option(roleUuid.Value.Value); - - return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); + return new RolesReportsHash(role, roleUuid.Value); } /// @@ -180,14 +176,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHash.Role.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - - if (rolesReportsHash.Role.IsSet) - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 3b9e8d5d172c..f64e8c9cd62e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(Option name = default) + public RolesReportsHashRole(string name) { Name = name; OnCreated(); @@ -48,7 +47,7 @@ public RolesReportsHashRole(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); - Option nameParsedValue = new Option(name.Value); - - return new RolesReportsHashRole(nameParsedValue); + return new RolesReportsHashRole(name); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHashRole.Name.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); - - if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value); + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 33a3dc97be70..9e9dc21151e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,8 +111,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string? shapeType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -131,10 +130,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -142,22 +141,13 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new ScaleneTriangle(shapeType, triangleType); } /// @@ -184,13 +174,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (scaleneTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); - - if (scaleneTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - - writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index e4d6646dc4c9..d8fbc094d19c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -136,7 +135,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +186,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -195,19 +194,14 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeTypeParsedValue); + return new Shape(quadrilateral, shapeType); if (triangle != null) - return new Shape(triangle, shapeTypeParsedValue); + return new Shape(triangle, shapeType); throw new JsonException(); } @@ -246,9 +240,6 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - if (shape.ShapeType == null) - throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 9a9d2701e0bc..1b0a8291f383 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,7 +102,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -129,15 +128,10 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - - string shapeTypeParsedValue = shapeType.Value; - - return new ShapeInterface(shapeTypeParsedValue); + return new ShapeInterface(shapeType); } /// @@ -164,9 +158,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - if (shapeInterface.ShapeType == null) - throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 5b3dd56409eb..1b75eada511b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -136,7 +135,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string? shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -187,7 +186,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -195,19 +194,14 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); + return new ShapeOrNull(quadrilateral, shapeType); if (triangle != null) - return new ShapeOrNull(triangle, shapeTypeParsedValue); + return new ShapeOrNull(triangle, shapeType); throw new JsonException(); } @@ -246,9 +240,6 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - if (shapeOrNull.ShapeType == null) - throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index e423dccac8c5..8945a243dfd2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -112,8 +111,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string? quadrilateralType = default; + string? shapeType = default; while (utf8JsonReader.Read()) { @@ -131,10 +130,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()!); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()!); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -142,22 +141,13 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new SimpleQuadrilateral(quadrilateralType, shapeType); } /// @@ -184,13 +174,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (simpleQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); - - if (simpleQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 915b7873a681..39baf9d3e4f0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + public SpecialModelName(string varSpecialModelName, long specialPropertyName) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -50,13 +49,13 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonPropertyName("_special_model.name_")] - public Option VarSpecialModelName { get; set; } + public string VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public Option SpecialPropertyName { get; set; } + public long SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varSpecialModelName = default; - Option specialPropertyName = default; + string? varSpecialModelName = default; + long? specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -131,11 +130,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = new Option(utf8JsonReader.GetString()!); + varSpecialModelName = utf8JsonReader.GetString(); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = utf8JsonReader.GetInt64(); break; default: break; @@ -143,16 +142,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + if (varSpecialModelName == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); - if (specialPropertyName.Value == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + if (specialPropertyName == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); - Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); - Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); - - return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); + return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); } /// @@ -179,12 +175,8 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - if (specialModelName.VarSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index c6ba102aefe9..1f69557e7d73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(Option id = default, Option name = default) + public Tag(long id, string name) { Id = id; Name = name; @@ -50,13 +49,13 @@ public Tag(Option id = default, Option name = default) /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -112,8 +111,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option name = default; + long? id = default; + string? name = default; while (utf8JsonReader.Read()) { @@ -132,10 +131,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "name": - name = new Option(utf8JsonReader.GetString()!); + name = utf8JsonReader.GetString(); break; default: break; @@ -143,16 +142,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); - Option idParsedValue = new Option(id.Value.Value); - Option nameParsedValue = new Option(name.Value); - - return new Tag(idParsedValue, nameParsedValue); + return new Tag(id.Value, name); } /// @@ -179,12 +175,8 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - if (tag.Name.Value == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value); + writer.WriteNumber("id", tag.Id); + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index da2ce0a17c4b..fa286e8f3fd6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(Option value = default) + public TestCollectionEndingWithWordList(string value) { Value = value; OnCreated(); @@ -48,7 +47,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Gets or Sets Value /// [JsonPropertyName("value")] - public Option Value { get; set; } + public string Value { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option value = default; + string? value = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = new Option(utf8JsonReader.GetString()!); + value = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value.Value == null) - throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + if (value == null) + throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); - Option valueParsedValue = new Option(value.Value); - - return new TestCollectionEndingWithWordList(valueParsedValue); + return new TestCollectionEndingWithWordList(value); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordList.Value.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); - - if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 6a0935dd35d4..5c481470c71a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -48,7 +47,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonPropertyName("TestCollectionEndingWithWordList")] - public Option> TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> testCollectionEndingWithWordList = default; + List? testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -130,12 +129,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); - - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -162,12 +159,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 237a67c659d7..95ad0601f978 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() + public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() { SomeProperty = someProperty; OnCreated(); @@ -48,7 +47,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public Option SomeProperty { get; set; } + public string SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -114,7 +113,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option someProperty = default; + string? someProperty = default; while (utf8JsonReader.Read()) { @@ -132,7 +131,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = new Option(utf8JsonReader.GetString()!); + someProperty = utf8JsonReader.GetString(); break; default: break; @@ -140,12 +139,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty.Value == null) - throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty == null) + throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - Option somePropertyParsedValue = new Option(someProperty.Value); - - return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -172,11 +169,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 7bfd7ebaa77f..c75c83f7d54b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -153,7 +152,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string? triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -210,7 +209,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -218,22 +217,17 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); - - string triangleTypeParsedValue = triangleType.Value; + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleTypeParsedValue); + return new Triangle(equilateralTriangle, triangleType); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleTypeParsedValue); + return new Triangle(isoscelesTriangle, triangleType); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleTypeParsedValue); + return new Triangle(scaleneTriangle, triangleType); throw new JsonException(); } @@ -277,9 +271,6 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - if (triangle.TriangleType == null) - throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index 2813cefdcfbb..a724643f7327 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,7 +102,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string? triangleType = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()!); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -129,15 +128,10 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - - string triangleTypeParsedValue = triangleType.Value; - - return new TriangleInterface(triangleTypeParsedValue); + return new TriangleInterface(triangleType); } /// @@ -164,9 +158,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - if (triangleInterface.TriangleType == null) - throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 0f0b6fe45f51..32df8b267426 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +46,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -70,78 +69,78 @@ public User(Option email = default, Option firstName = default, /// Gets or Sets Email /// [JsonPropertyName("email")] - public Option Email { get; set; } + public string Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public Option FirstName { get; set; } + public string FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public Option LastName { get; set; } + public string LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Option ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public Option Password { get; set; } + public string Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public Option Phone { get; set; } + public string Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public Option UserStatus { get; set; } + public int UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public Option Username { get; set; } + public string Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Option AnyTypeProp { get; set; } + public Object? AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Option AnyTypePropNullable { get; set; } + public Object? AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Option ObjectWithNoDeclaredPropsNullable { get; set; } + public Object? ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -207,18 +206,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option email = default; - Option firstName = default; - Option id = default; - Option lastName = default; - Option objectWithNoDeclaredProps = default; - Option password = default; - Option phone = default; - Option userStatus = default; - Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; + string? email = default; + string? firstName = default; + long? id = default; + string? lastName = default; + Object? objectWithNoDeclaredProps = default; + string? password = default; + string? phone = default; + int? userStatus = default; + string? username = default; + Object? anyTypeProp = default; + Object? anyTypePropNullable = default; + Object? objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -236,46 +235,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = new Option(utf8JsonReader.GetString()!); + email = utf8JsonReader.GetString(); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = utf8JsonReader.GetString(); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + lastName = utf8JsonReader.GetString(); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); + objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "password": - password = new Option(utf8JsonReader.GetString()!); + password = utf8JsonReader.GetString(); break; case "phone": - phone = new Option(utf8JsonReader.GetString()!); + phone = utf8JsonReader.GetString(); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = utf8JsonReader.GetInt32(); break; case "username": - username = new Option(utf8JsonReader.GetString()!); + username = utf8JsonReader.GetString(); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -283,44 +282,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email.Value == null) - throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + if (email == null) + throw new ArgumentNullException(nameof(email), "Property is required for class User."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class User."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); - if (objectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + if (objectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class User."); - if (phone.Value == null) - throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + if (phone == null) + throw new ArgumentNullException(nameof(phone), "Property is required for class User."); - if (userStatus.Value == null) - throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + if (userStatus == null) + throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); - if (username.Value == null) - throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + if (username == null) + throw new ArgumentNullException(nameof(username), "Property is required for class User."); - Option emailParsedValue = new Option(email.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option idParsedValue = new Option(id.Value.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); - Option passwordParsedValue = new Option(password.Value); - Option phoneParsedValue = new Option(phone.Value); - Option userStatusParsedValue = new Option(userStatus.Value.Value); - Option usernameParsedValue = new Option(username.Value); - - return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -347,62 +336,22 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - if (user.Email.Value == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); - - if (user.FirstName.Value == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); - - if (user.LastName.Value == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); - - if (user.ObjectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); - - if (user.Password.Value == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); - - if (user.Phone.Value == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); - - if (user.Username.Value == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) - if (user.AnyTypeProp.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullable.IsSet) - if (user.AnyTypePropNullable.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullable.IsSet) - if (user.ObjectWithNoDeclaredPropsNullable.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); + writer.WriteString("email", user.Email); + writer.WriteString("firstName", user.FirstName); + writer.WriteNumber("id", user.Id); + writer.WriteString("lastName", user.LastName); + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); + writer.WriteString("phone", user.Phone); + writer.WriteNumber("userStatus", user.UserStatus); + writer.WriteString("username", user.Username); + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 14e6bf888455..59099f90e2de 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + public Whale(string className, bool hasBaleen, bool hasTeeth) { ClassName = className; HasBaleen = hasBaleen; @@ -58,13 +57,13 @@ public Whale(string className, Option hasBaleen = default, Option ha /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public Option HasBaleen { get; set; } + public bool HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public Option HasTeeth { get; set; } + public bool HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -121,9 +120,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option hasBaleen = default; - Option hasTeeth = default; + string? className = default; + bool? hasBaleen = default; + bool? hasTeeth = default; while (utf8JsonReader.Read()) { @@ -141,15 +140,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = utf8JsonReader.GetBoolean(); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = utf8JsonReader.GetBoolean(); break; default: break; @@ -157,23 +156,16 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Whale.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + if (hasBaleen == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); - if (hasBaleen.Value == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + if (hasTeeth == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); - if (hasTeeth.Value == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - - string classNameParsedValue = className.Value; - Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); - Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); - - return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); + return new Whale(className, hasBaleen.Value, hasTeeth.Value); } /// @@ -200,12 +192,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - if (whale.ClassName == null) - throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - - writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); + writer.WriteString("className", whale.ClassName); + writer.WriteBoolean("hasBaleen", whale.HasBaleen); + writer.WriteBoolean("hasTeeth", whale.HasTeeth); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index a97aae2b9958..f3a1c274ec5f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, Option type = default) : base() + public Zebra(string className, TypeEnum type) : base() { ClassName = className; Type = type; @@ -114,6 +113,7 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { + if (value == TypeEnum.Plains) return "plains"; @@ -130,7 +130,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public TypeEnum Type { get; set; } /// /// Gets or Sets ClassName @@ -203,8 +203,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option type = default; + string? className = default; + Zebra.TypeEnum? type = default; while (utf8JsonReader.Read()) { @@ -222,12 +222,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()!); + className = utf8JsonReader.GetString(); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - if (typeRawValue != null) - type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + type = typeRawValue == null + ? null + : Zebra.TypeEnumFromStringOrDefault(typeRawValue); break; default: break; @@ -235,19 +236,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Zebra.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - string classNameParsedValue = className.Value; - Option typeParsedValue = new Option(type.Value.Value); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); - return new Zebra(classNameParsedValue, typeParsedValue); + return new Zebra(className, type.Value); } /// @@ -274,10 +269,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - if (zebra.ClassName == null) - throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); - writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 1db14d35a9e5..60223b9ff74f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 5305591a209e..27d16e96c2b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(Option zeroBasedEnum = default) + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -101,6 +100,7 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { + if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -114,7 +114,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public Option ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -169,7 +169,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option zeroBasedEnum = default; + ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -188,8 +188,9 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - if (zeroBasedEnumRawValue != null) - zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + zeroBasedEnum = zeroBasedEnumRawValue == null + ? null + : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); break; default: break; @@ -197,12 +198,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum.Value == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - - Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); + return new ZeroBasedEnumClass(zeroBasedEnum.Value); } /// @@ -229,7 +228,8 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index 05049077c2ac..1179de6767be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -79,7 +79,6 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md -docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -207,7 +206,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md index 470701a32abc..53bbfe31e77c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md index ab628ed7bc0b..28f1a8093581 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md @@ -4,11 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | -**Number** | **decimal** | | -**Password** | **string** | | -**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -16,6 +14,8 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] +**Number** | **decimal** | | +**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md index 4f019b613bd7..b13bb576b450 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | -**PhotoUrls** | **List<string>** | | **Category** | [**Category**](Category.md) | | [optional] **Id** | **long** | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md deleted file mode 100644 index 5ff4cb1b73cc..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNotNullableDateProp** | **DateTime** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNotnullableEnumInteger** | **int** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**RequiredNotnullableEnumString** | **string** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableStringProp** | **string** | | -**RequiredNotnullableUuid** | **Guid** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNullableBooleanProp** | **bool** | | -**RequiredNullableDateProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime** | | -**RequiredNullableEnumInteger** | **int** | | -**RequiredNullableEnumIntegerOnly** | **int** | | -**RequiredNullableEnumString** | **string** | | -**RequiredNullableIntegerProp** | **int** | | -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNullableStringProp** | **string** | | -**RequiredNullableUuid** | **Guid** | | -**NotRequiredNullableDateProp** | **DateTime** | | [optional] -**NotRequiredNullableIntegerProp** | **int** | | [optional] -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNullableBooleanProp** | **bool** | | [optional] -**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNullableEnumInteger** | **int** | | [optional] -**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNullableUuid** | **Guid** | | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 62a5cdba43b7..6c82be59af88 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,16 +219,6 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } - /// - /// Test TestInlineFreeformAdditionalProperties - /// - [Fact (Skip = "not implemented")] - public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() - { - TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; - await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); - } - /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index b78fc06d07c5..7fe8f333c81a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index bfec38903066..e5a97f428662 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,15 +53,6 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'EnumInteger' /// @@ -98,6 +89,15 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index 164baa8862be..fbffe502af78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -54,48 +54,30 @@ public void FormatTestInstanceTest() } /// - /// Test the property 'VarByte' - /// - [Fact] - public void VarByteTest() - { - // TODO unit test for the property 'VarByte' - } - - /// - /// Test the property 'Date' - /// - [Fact] - public void DateTest() - { - // TODO unit test for the property 'Date' - } - - /// - /// Test the property 'Number' + /// Test the property 'Binary' /// [Fact] - public void NumberTest() + public void BinaryTest() { - // TODO unit test for the property 'Number' + // TODO unit test for the property 'Binary' } /// - /// Test the property 'Password' + /// Test the property 'VarByte' /// [Fact] - public void PasswordTest() + public void VarByteTest() { - // TODO unit test for the property 'Password' + // TODO unit test for the property 'VarByte' } /// - /// Test the property 'Binary' + /// Test the property 'Date' /// [Fact] - public void BinaryTest() + public void DateTest() { - // TODO unit test for the property 'Binary' + // TODO unit test for the property 'Date' } /// @@ -161,6 +143,24 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index 8485d1213ce6..fff8db45faad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 6e8958b1b749..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,452 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index f6e2fb899672..e88b5ed621ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -141,8 +141,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -151,6 +149,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,30 +167,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) - return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) - return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) - return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) - return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) - return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) - return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 0cd32640adfe..5ea9415eba07 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,7 +114,6 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); - _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs index 34653363aacf..70f41078bb68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,17 +35,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 8d49c1b094c4..42747dee35ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Option>> activityOutputs = default) + public Activity(Dictionary> activityOutputs) { ActivityOutputs = activityOutputs; OnCreated(); @@ -46,7 +45,7 @@ public Activity(Option [JsonPropertyName("activity_outputs")] - public Option>> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> activityOutputs = default; + Dictionary> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs.Value == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + if (activityOutputs == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); - Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); - - return new Activity(activityOutputsParsedValue); + return new Activity(activityOutputs); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - if (activity.ActivityOutputs.Value == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - - if (activity.ActivityOutputs.IsSet) - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 9927e551973e..233d362f51ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + public ActivityOutputElementRepresentation(string prop1, Object prop2) { Prop1 = prop1; Prop2 = prop2; @@ -48,13 +47,13 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public Option Prop1 { get; set; } + public string Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Option Prop2 { get; set; } + public Object Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option prop1 = default; - Option prop2 = default; + string prop1 = default; + Object prop2 = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = new Option(utf8JsonReader.GetString()); + prop1 = utf8JsonReader.GetString(); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -141,16 +140,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1.Value == null) - throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop1 == null) + throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); - if (prop2.Value == null) - throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop2 == null) + throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); - Option prop1ParsedValue = new Option(prop1.Value); - Option prop2ParsedValue = new Option(prop2.Value); - - return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -177,16 +173,9 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - if (activityOutputElementRepresentation.Prop1.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop2.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e4580e3489eb..ed15d711b7a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -41,7 +40,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -61,49 +60,49 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Option EmptyMap { get; set; } + public Object EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Option>> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Option> MapProperty { get; set; } + public Dictionary MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Option> MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Option Anytype1 { get; set; } + public Object Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -165,14 +164,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option emptyMap = default; - Option>> mapOfMapProperty = default; - Option> mapProperty = default; - Option mapWithUndeclaredPropertiesAnytype1 = default; - Option mapWithUndeclaredPropertiesAnytype2 = default; - Option> mapWithUndeclaredPropertiesAnytype3 = default; - Option> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; + Object emptyMap = default; + Dictionary> mapOfMapProperty = default; + Dictionary mapProperty = default; + Object mapWithUndeclaredPropertiesAnytype1 = default; + Object mapWithUndeclaredPropertiesAnytype2 = default; + Dictionary mapWithUndeclaredPropertiesAnytype3 = default; + Dictionary mapWithUndeclaredPropertiesString = default; + Object anytype1 = default; while (utf8JsonReader.Read()) { @@ -191,35 +190,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -227,36 +226,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap.Value == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + if (emptyMap == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); - if (mapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapOfMapProperty == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapProperty.Value == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapProperty == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - Option emptyMapParsedValue = new Option(emptyMap.Value); - Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); - Option> mapPropertyParsedValue = new Option>(mapProperty.Value); - Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); - Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); - Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); - Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); - - return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -283,56 +274,22 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (additionalPropertiesClass.EmptyMap.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.EmptyMap.IsSet) - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapProperty.IsSet) - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapProperty.IsSet) - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1.IsSet) - if (additionalPropertiesClass.Anytype1.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 9d3a5c581ac7..460543ebf0df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, Option color = default) + public Animal(string className, string color = @"red") { ClassName = className; Color = color; @@ -54,7 +53,7 @@ public Animal(string className, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -120,8 +119,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option color = default; + string className = default; + string color = default; while (utf8JsonReader.Read()) { @@ -139,10 +138,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -150,19 +149,13 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Animal.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - - string classNameParsedValue = className.Value; - Option colorParsedValue = new Option(color.Value); - - return new Animal(classNameParsedValue, colorParsedValue); + return new Animal(className, color); } /// @@ -189,14 +182,8 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - if (animal.ClassName == null) - throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); - - if (animal.Color.Value == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - - writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value); + writer.WriteString("className", animal.ClassName); + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index a9c88ec75107..5a7be95495cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(Option code = default, Option message = default, Option type = default) + public ApiResponse(int code, string message, string type) { Code = code; Message = message; @@ -50,19 +49,19 @@ public ApiResponse(Option code = default, Option message = default, /// Gets or Sets Code /// [JsonPropertyName("code")] - public Option Code { get; set; } + public int Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public Option Message { get; set; } + public string Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public string Type { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option code = default; - Option message = default; - Option type = default; + int? code = default; + string message = default; + string type = default; while (utf8JsonReader.Read()) { @@ -140,13 +139,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = utf8JsonReader.GetInt32(); break; case "message": - message = new Option(utf8JsonReader.GetString()); + message = utf8JsonReader.GetString(); break; case "type": - type = new Option(utf8JsonReader.GetString()); + type = utf8JsonReader.GetString(); break; default: break; @@ -154,20 +153,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code.Value == null) - throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + if (code == null) + throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); - if (message.Value == null) - throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + if (message == null) + throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); - Option codeParsedValue = new Option(code.Value.Value); - Option messageParsedValue = new Option(message.Value); - Option typeParsedValue = new Option(type.Value); - - return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); + return new ApiResponse(code.Value, message, type); } /// @@ -194,16 +189,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - if (apiResponse.Message.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); - - if (apiResponse.Type.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value); + writer.WriteNumber("code", apiResponse.Code); + writer.WriteString("message", apiResponse.Message); + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index fde2a2e345fd..31246df0422a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + public Apple(string colorCode, string cultivar, string origin) { ColorCode = colorCode; Cultivar = cultivar; @@ -50,19 +49,19 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public Option ColorCode { get; set; } + public string ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public Option Cultivar { get; set; } + public string Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public Option Origin { get; set; } + public string Origin { get; set; } /// /// Gets or Sets additional properties @@ -93,28 +92,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode.Value != null) { + if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode.Value).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar.Value != null) { + if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar.Value).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin.Value != null) { + if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin.Value).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -146,9 +145,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option colorCode = default; - Option cultivar = default; - Option origin = default; + string colorCode = default; + string cultivar = default; + string origin = default; while (utf8JsonReader.Read()) { @@ -166,13 +165,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = new Option(utf8JsonReader.GetString()); + colorCode = utf8JsonReader.GetString(); break; case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()); + cultivar = utf8JsonReader.GetString(); break; case "origin": - origin = new Option(utf8JsonReader.GetString()); + origin = utf8JsonReader.GetString(); break; default: break; @@ -180,20 +179,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode.Value == null) - throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + if (colorCode == null) + throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); - if (origin.Value == null) - throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + if (origin == null) + throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); - Option colorCodeParsedValue = new Option(colorCode.Value); - Option cultivarParsedValue = new Option(cultivar.Value); - Option originParsedValue = new Option(origin.Value); - - return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); + return new Apple(colorCode, cultivar, origin); } /// @@ -220,19 +215,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.ColorCode.Value == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); - - if (apple.Cultivar.Value == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); - - if (apple.Origin.Value == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value); + writer.WriteString("color_code", apple.ColorCode); + writer.WriteString("cultivar", apple.Cultivar); + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index 18fc7f3f3216..e0882d925c5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, Option mealy = default) + public AppleReq(string cultivar, bool mealy) { Cultivar = cultivar; Mealy = mealy; @@ -54,7 +53,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public Option Mealy { get; set; } + public bool Mealy { get; set; } /// /// Returns the string presentation of the object @@ -103,8 +102,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option cultivar = default; - Option mealy = default; + string cultivar = default; + bool? mealy = default; while (utf8JsonReader.Read()) { @@ -122,11 +121,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()); + cultivar = utf8JsonReader.GetString(); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = utf8JsonReader.GetBoolean(); break; default: break; @@ -134,19 +133,13 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!cultivar.IsSet) - throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + if (mealy == null) + throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); - if (mealy.Value == null) - throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - - string cultivarParsedValue = cultivar.Value; - Option mealyParsedValue = new Option(mealy.Value.Value); - - return new AppleReq(cultivarParsedValue, mealyParsedValue); + return new AppleReq(cultivar, mealy.Value); } /// @@ -173,11 +166,8 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - if (appleReq.Cultivar == null) - throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - - writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) - writer.WriteBoolean("mealy", appleReq.Mealy.Value); + writer.WriteString("cultivar", appleReq.Cultivar); + writer.WriteBoolean("mealy", appleReq.Mealy); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 2e8732df9d7b..6fc0afdbc300 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -46,7 +45,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public Option>> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayNumber = default; + List> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); - - return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index d05e04d3f1d3..0715a3fdf65f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(Option> arrayNumber = default) + public ArrayOfNumberOnly(List arrayNumber) { ArrayNumber = arrayNumber; OnCreated(); @@ -46,7 +45,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public Option> ArrayNumber { get; set; } + public List ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayNumber = default; + List arrayNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + if (arrayNumber == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); - Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); - - return new ArrayOfNumberOnly(arrayNumberParsedValue); + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfNumberOnly.ArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - - if (arrayOfNumberOnly.ArrayNumber.IsSet) - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 3c3b95bfaeb7..43088ca1d97b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -50,19 +49,19 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public Option>> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public Option>> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public Option> ArrayOfString { get; set; } + public List ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayOfInteger = default; - Option>> arrayArrayOfModel = default; - Option> arrayOfString = default; + List> arrayArrayOfInteger = default; + List> arrayArrayOfModel = default; + List arrayOfString = default; while (utf8JsonReader.Read()) { @@ -140,15 +139,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -156,20 +155,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); - if (arrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); - if (arrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + if (arrayOfString == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); - Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); - Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); - Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); - - return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -196,24 +191,12 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - if (arrayTest.ArrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfInteger.IsSet) - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModel.IsSet) - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfString.IsSet) - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index 04833c9c802b..75bab7a8d056 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(Option lengthCm = default) + public Banana(decimal lengthCm) { LengthCm = lengthCm; OnCreated(); @@ -46,7 +45,7 @@ public Banana(Option lengthCm = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public Option LengthCm { get; set; } + public decimal LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; + decimal? lengthCm = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; default: break; @@ -128,12 +127,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); - Option lengthCmParsedValue = new Option(lengthCm.Value.Value); - - return new Banana(lengthCmParsedValue); + return new Banana(lengthCm.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.LengthCm.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCm.Value); + writer.WriteNumber("lengthCm", banana.LengthCm); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 33deb0eeffd9..61e5cf312cca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, Option sweet = default) + public BananaReq(decimal lengthCm, bool sweet) { LengthCm = lengthCm; Sweet = sweet; @@ -54,7 +53,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public Option Sweet { get; set; } + public bool Sweet { get; set; } /// /// Returns the string presentation of the object @@ -103,8 +102,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; - Option sweet = default; + decimal? lengthCm = default; + bool? sweet = default; while (utf8JsonReader.Read()) { @@ -123,11 +122,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = utf8JsonReader.GetBoolean(); break; default: break; @@ -135,19 +134,13 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!lengthCm.IsSet) - throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + if (sweet == null) + throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); - if (sweet.Value == null) - throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - - decimal lengthCmParsedValue = lengthCm.Value.Value; - Option sweetParsedValue = new Option(sweet.Value.Value); - - return new BananaReq(lengthCmParsedValue, sweetParsedValue); + return new BananaReq(lengthCm.Value, sweet.Value); } /// @@ -174,8 +167,8 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) - writer.WriteBoolean("sweet", bananaReq.Sweet.Value); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + writer.WriteBoolean("sweet", bananaReq.Sweet); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index 6bba0c922377..c9e4a8bc7120 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - - string classNameParsedValue = className.Value; - - return new BasquePig(classNameParsedValue); + return new BasquePig(className); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - if (basquePig.ClassName == null) - throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index b7384c4a5b19..ca7eb413c65b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -57,37 +56,37 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public Option ATT_NAME { get; set; } + public string ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public Option CapitalCamel { get; set; } + public string CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public Option CapitalSnake { get; set; } + public string CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public Option SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public Option SmallCamel { get; set; } + public string SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public Option SmallSnake { get; set; } + public string SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -147,12 +146,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option aTTNAME = default; - Option capitalCamel = default; - Option capitalSnake = default; - Option sCAETHFlowPoints = default; - Option smallCamel = default; - Option smallSnake = default; + string aTTNAME = default; + string capitalCamel = default; + string capitalSnake = default; + string sCAETHFlowPoints = default; + string smallCamel = default; + string smallSnake = default; while (utf8JsonReader.Read()) { @@ -170,22 +169,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = new Option(utf8JsonReader.GetString()); + aTTNAME = utf8JsonReader.GetString(); break; case "CapitalCamel": - capitalCamel = new Option(utf8JsonReader.GetString()); + capitalCamel = utf8JsonReader.GetString(); break; case "Capital_Snake": - capitalSnake = new Option(utf8JsonReader.GetString()); + capitalSnake = utf8JsonReader.GetString(); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); + sCAETHFlowPoints = utf8JsonReader.GetString(); break; case "smallCamel": - smallCamel = new Option(utf8JsonReader.GetString()); + smallCamel = utf8JsonReader.GetString(); break; case "small_Snake": - smallSnake = new Option(utf8JsonReader.GetString()); + smallSnake = utf8JsonReader.GetString(); break; default: break; @@ -193,32 +192,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME.Value == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + if (aTTNAME == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); - if (capitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + if (capitalCamel == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); - if (capitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + if (capitalSnake == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); - if (sCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + if (sCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); - if (smallCamel.Value == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + if (smallCamel == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); - if (smallSnake.Value == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + if (smallSnake == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); - Option aTTNAMEParsedValue = new Option(aTTNAME.Value); - Option capitalCamelParsedValue = new Option(capitalCamel.Value); - Option capitalSnakeParsedValue = new Option(capitalSnake.Value); - Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); - Option smallCamelParsedValue = new Option(smallCamel.Value); - Option smallSnakeParsedValue = new Option(smallSnake.Value); - - return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -245,31 +237,12 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - if (capitalization.ATT_NAME.Value == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); - - if (capitalization.CapitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); - - if (capitalization.CapitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); - - if (capitalization.SCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); - - if (capitalization.SmallCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); - - if (capitalization.SmallSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value); + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + writer.WriteString("smallCamel", capitalization.SmallCamel); + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index b5818597320e..619fc52ce11c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, bool declawed, string color = @"red") : base(className, color) { Declawed = declawed; OnCreated(); @@ -48,7 +47,7 @@ public Cat(string className, Option declawed = default, Option col /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public Option Declawed { get; set; } + public bool Declawed { get; set; } /// /// Returns the string presentation of the object @@ -87,9 +86,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option declawed = default; - Option color = default; + string className = default; + bool? declawed = default; + string color = default; while (utf8JsonReader.Read()) { @@ -107,14 +106,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = utf8JsonReader.GetBoolean(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -122,23 +121,16 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Cat.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + if (declawed == null) + throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); - if (declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - - string classNameParsedValue = className.Value; - Option declawedParsedValue = new Option(declawed.Value.Value); - Option colorParsedValue = new Option(color.Value); - - return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); + return new Cat(className, declawed.Value, color); } /// @@ -165,15 +157,9 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - if (cat.ClassName == null) - throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); - - if (cat.Color.Value == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - - writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value); + writer.WriteString("className", cat.ClassName); + writer.WriteBoolean("declawed", cat.Declawed); + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 4354c0ae89cd..6139c3048390 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,29 +31,29 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(long id, string name = @"default-name") { - Name = name; Id = id; + Name = name; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Name + /// Gets or Sets Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long Id { get; set; } /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public Option Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -70,8 +69,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -110,8 +109,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option id = default; + long? id = default; + string name = default; while (utf8JsonReader.Read()) { @@ -128,12 +127,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); break; default: break; @@ -141,19 +140,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Category.", nameof(name)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - string nameParsedValue = name.Value; - Option idParsedValue = new Option(id.Value.Value); - - return new Category(nameParsedValue, idParsedValue); + return new Category(id.Value, name); } /// @@ -180,11 +173,8 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - - writer.WriteString("name", category.Name); if (category.Id.IsSet) - writer.WriteNumber("id", category.Id.Value); + writer.WriteNumber("id", category.Id); + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 36e500ad991f..a32821259868 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) + public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) { Name = name; PetType = petType; @@ -90,6 +89,7 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { + if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -100,13 +100,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new Option PetType { get; set; } + public new PetTypeEnum PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Returns the string presentation of the object @@ -146,8 +146,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option petType = default; + string name = default; + ChildCat.PetTypeEnum? petType = default; while (utf8JsonReader.Read()) { @@ -165,12 +165,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - if (petTypeRawValue != null) - petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + petType = petTypeRawValue == null + ? null + : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); break; default: break; @@ -178,16 +179,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); - Option nameParsedValue = new Option(name.Value); - Option petTypeParsedValue = new Option(petType.Value.Value); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); - return new ChildCat(nameParsedValue, petTypeParsedValue); + return new ChildCat(name, petType.Value); } /// @@ -214,11 +212,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - if (childCat.Name.Value == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + writer.WriteString("name", childCat.Name); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index d0aa150655d9..d1c65d368199 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(Option varClass = default) + public ClassModel(string varClass) { VarClass = varClass; OnCreated(); @@ -46,7 +45,7 @@ public ClassModel(Option varClass = default) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; + string varClass = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = new Option(utf8JsonReader.GetString()); + varClass = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); - Option varClassParsedValue = new Option(varClass.Value); - - return new ClassModel(varClassParsedValue); + return new ClassModel(varClass); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - if (classModel.VarClass.Value == null) - throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); - - if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value); + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 4565776de706..79579247f7e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new ComplexQuadrilateral(quadrilateralType, shapeType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (complexQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); - - if (complexQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 0c7b565c1bb1..84439210bcfc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - - string classNameParsedValue = className.Value; - - return new DanishPig(classNameParsedValue); + return new DanishPig(className); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - if (danishPig.ClassName == null) - throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 8f25aa4445dd..4420630af349 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(Option dateOnlyProperty = default) + public DateOnlyClass(DateTime dateOnlyProperty) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -47,7 +46,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public Option DateOnlyProperty { get; set; } + public DateTime DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -107,7 +106,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateOnlyProperty = default; + DateTime? dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -126,7 +125,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -134,12 +133,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty.Value == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + if (dateOnlyProperty == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); - Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); - - return new DateOnlyClass(dateOnlyPropertyParsedValue); + return new DateOnlyClass(dateOnlyProperty.Value); } /// @@ -166,8 +163,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index e8c1b2b516ad..16e3dfe57faa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(Option name = default) + public DeprecatedObject(string name) { Name = name; OnCreated(); @@ -46,7 +45,7 @@ public DeprecatedObject(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string name = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); - Option nameParsedValue = new Option(name.Value); - - return new DeprecatedObject(nameParsedValue); + return new DeprecatedObject(name); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - if (deprecatedObject.Name.Value == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); - - if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value); + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index 5bf025cfe1be..810934b95efe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,11 +31,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// className /// breed + /// className /// color (default to "red") [JsonConstructor] - public Dog(string className, Option breed = default, Option color = default) : base(className, color) + public Dog(string breed, string className, string color = @"red") : base(className, color) { Breed = breed; OnCreated(); @@ -48,7 +47,7 @@ public Dog(string className, Option breed = default, Option colo /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public Option Breed { get; set; } + public string Breed { get; set; } /// /// Returns the string presentation of the object @@ -87,9 +86,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option breed = default; - Option color = default; + string breed = default; + string className = default; + string color = default; while (utf8JsonReader.Read()) { @@ -106,14 +105,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "className": - className = new Option(utf8JsonReader.GetString()); - break; case "breed": - breed = new Option(utf8JsonReader.GetString()); + breed = utf8JsonReader.GetString(); + break; + case "className": + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -121,23 +120,16 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Dog.", nameof(className)); + if (breed == null) + throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (breed.Value == null) - throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - - string classNameParsedValue = className.Value; - Option breedParsedValue = new Option(breed.Value); - Option colorParsedValue = new Option(color.Value); - - return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); + return new Dog(breed, className, color); } /// @@ -164,18 +156,9 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - if (dog.ClassName == null) - throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); - - if (dog.Breed.Value == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); - - if (dog.Color.Value == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - - writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value); + writer.WriteString("breed", dog.Breed); + writer.WriteString("className", dog.ClassName); + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index aab2bfe5fa5b..68f7676ff91f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -52,25 +51,25 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Option MainShape { get; set; } + public Shape MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public Option> Shapes { get; set; } + public List Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public Option NullableShape { get; set; } + public NullableShape NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public Option ShapeOrNull { get; set; } + public ShapeOrNull ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -139,10 +138,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option mainShape = default; - Option> shapes = default; - Option nullableShape = default; - Option shapeOrNull = default; + Shape mainShape = default; + List shapes = default; + NullableShape nullableShape = default; + ShapeOrNull shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -161,19 +160,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -181,16 +180,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape.Value == null) - throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + if (mainShape == null) + throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); - if (shapes.Value == null) - throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + if (shapes == null) + throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); - Option mainShapeParsedValue = new Option(mainShape.Value); - Option> shapesParsedValue = new Option>(shapes.Value); - - return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -217,34 +213,14 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - if (drawing.MainShape.Value == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); - - if (drawing.Shapes.Value == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - - if (drawing.MainShape.IsSet) - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.Shapes.IsSet) - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShape.IsSet) - if (drawing.NullableShape.Value != null) - { - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - } - else - writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNull.IsSet) - if (drawing.ShapeOrNull.Value != null) - { - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); - } - else - writer.WriteNull("shapeOrNull"); + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index e89d8ebabcec..58cf3e310f81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -101,6 +100,7 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { + if (value == ArrayEnumEnum.Fish) return "fish"; @@ -167,6 +167,7 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -180,13 +181,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public Option JustSymbol { get; set; } + public JustSymbolEnum JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public Option> ArrayEnum { get; set; } + public List ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -242,8 +243,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayEnum = default; - Option justSymbol = default; + List arrayEnum = default; + EnumArrays.JustSymbolEnum? justSymbol = default; while (utf8JsonReader.Read()) { @@ -262,12 +263,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - if (justSymbolRawValue != null) - justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + justSymbol = justSymbolRawValue == null + ? null + : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); break; default: break; @@ -275,16 +277,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum.Value == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - - if (justSymbol.Value == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + if (arrayEnum == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); - Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); - Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + if (justSymbol == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); - return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); + return new EnumArrays(arrayEnum, justSymbol.Value); } /// @@ -311,13 +310,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - if (enumArrays.ArrayEnum.Value == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - if (enumArrays.ArrayEnum.IsSet) - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs index b1aff0adf0d8..94c2361c8810 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 1e7c2e182a77..f3310c22a12b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,23 +31,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString + /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) { - EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; + EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -58,162 +57,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Defines EnumInteger /// @@ -277,7 +120,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public Option EnumInteger { get; set; } + public EnumIntegerEnum EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -342,7 +185,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public Option EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -401,6 +244,7 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -414,7 +258,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public Option EnumNumber { get; set; } + public EnumNumberEnum EnumNumber { get; set; } /// /// Defines EnumString @@ -539,6 +383,7 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// public static string EnumStringEnumToJsonValue(EnumStringEnum value) { + if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -570,31 +415,188 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public Option EnumString { get; set; } + public EnumStringEnum EnumString { get; set; } + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public Option OuterEnumDefaultValue { get; set; } + public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public Option OuterEnumInteger { get; set; } + public OuterEnumInteger OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public Option OuterEnumIntegerDefaultValue { get; set; } + public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public Option OuterEnum { get; set; } + public OuterEnum? OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -610,11 +612,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -657,15 +659,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option enumStringRequired = default; - Option enumInteger = default; - Option enumIntegerOnly = default; - Option enumNumber = default; - Option enumString = default; - Option outerEnumDefaultValue = default; - Option outerEnumInteger = default; - Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; + EnumTest.EnumIntegerEnum? enumInteger = default; + EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; + EnumTest.EnumNumberEnum? enumNumber = default; + EnumTest.EnumStringEnum? enumString = default; + EnumTest.EnumStringRequiredEnum? enumStringRequired = default; + OuterEnumDefaultValue? outerEnumDefaultValue = default; + OuterEnumInteger? outerEnumInteger = default; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; + OuterEnum? outerEnum = default; while (utf8JsonReader.Read()) { @@ -682,47 +684,53 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - if (enumStringRequiredRawValue != null) - enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); - break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - if (enumStringRawValue != null) - enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + enumString = enumStringRawValue == null + ? null + : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); + break; + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + enumStringRequired = enumStringRequiredRawValue == null + ? null + : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumDefaultValueRawValue != null) - outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + outerEnumDefaultValue = outerEnumDefaultValueRawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerRawValue != null) - outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + outerEnumInteger = outerEnumIntegerRawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerDefaultValueRawValue != null) - outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + outerEnum = outerEnumRawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); break; default: break; @@ -730,43 +738,31 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!enumStringRequired.IsSet) - throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - - if (enumStringRequired.Value == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + if (enumInteger == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); - if (enumInteger.Value == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + if (enumIntegerOnly == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); - if (enumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + if (enumNumber == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); - if (enumNumber.Value == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + if (enumString == null) + throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); - if (enumString.Value == null) - throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + if (enumStringRequired == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (outerEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); - if (outerEnumInteger.Value == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + if (outerEnumInteger == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); - if (outerEnumIntegerDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumIntegerDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); - EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; - Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); - Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); - Option enumNumberParsedValue = new Option(enumNumber.Value.Value); - Option enumStringParsedValue = new Option(enumString.Value.Value); - Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); - Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); - Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); - - return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); + return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); } /// @@ -793,44 +789,44 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); + else + writer.WriteNull("enum_string"); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - if (enumTest.OuterEnumDefaultValue.IsSet) - { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + if (outerEnumDefaultValueRawValue != null) writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - } - if (enumTest.OuterEnumInteger.IsSet) - { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - } - if (enumTest.OuterEnumIntegerDefaultValue.IsSet) + else + writer.WriteNull("outerEnumDefaultValue"); + + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + + if (enumTest.OuterEnum == null) + writer.WriteNull("outerEnum"); + else { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); - } - if (enumTest.OuterEnum.IsSet) - if (enumTest.OuterEnum.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); + if (outerEnumRawValue != null) writer.WriteString("outerEnum", outerEnumRawValue); - } else writer.WriteNull("outerEnum"); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 7af10613ef2f..626748ff2097 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new EquilateralTriangle(shapeType, triangleType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (equilateralTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); - - if (equilateralTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - - writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index 9655d5cd5b6d..905e5452f7c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(Option sourceURI = default) + public File(string sourceURI) { SourceURI = sourceURI; OnCreated(); @@ -47,7 +46,7 @@ public File(Option sourceURI = default) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public Option SourceURI { get; set; } + public string SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +101,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option sourceURI = default; + string sourceURI = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = new Option(utf8JsonReader.GetString()); + sourceURI = utf8JsonReader.GetString(); break; default: break; @@ -128,12 +127,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI.Value == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + if (sourceURI == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); - Option sourceURIParsedValue = new Option(sourceURI.Value); - - return new File(sourceURIParsedValue); + return new File(sourceURI); } /// @@ -160,11 +157,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - if (file.SourceURI.Value == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); - - if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value); + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 97249c594263..722ba3b949f0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(Option file = default, Option> files = default) + public FileSchemaTestClass(File file, List files) { File = file; Files = files; @@ -48,13 +47,13 @@ public FileSchemaTestClass(Option file = default, Option> files /// Gets or Sets File /// [JsonPropertyName("file")] - public Option File { get; set; } + public File File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public Option> Files { get; set; } + public List Files { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option file = default; - Option> files = default; + File file = default; + List files = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -142,16 +141,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file.Value == null) - throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + if (file == null) + throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); - if (files.Value == null) - throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + if (files == null) + throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); - Option fileParsedValue = new Option(file.Value); - Option> filesParsedValue = new Option>(files.Value); - - return new FileSchemaTestClass(fileParsedValue, filesParsedValue); + return new FileSchemaTestClass(file, files); } /// @@ -178,18 +174,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - if (fileSchemaTestClass.File.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.Files.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.File.IsSet) - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.Files.IsSet) - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index b4f1a36c4f8c..9cfe3b508fe8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(Option bar = default) + public Foo(string bar = @"bar") { Bar = bar; OnCreated(); @@ -46,7 +45,7 @@ public Foo(Option bar = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; set; } + public string Bar { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; + string bar = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); - Option barParsedValue = new Option(bar.Value); - - return new Foo(barParsedValue); + return new Foo(bar); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - if (foo.Bar.Value == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); - - if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value); + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 4dc68e62b6e4..c8291e8eae5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Option varString = default) + public FooGetDefaultResponse(Foo varString) { VarString = varString; OnCreated(); @@ -46,7 +45,7 @@ public FooGetDefaultResponse(Option varString = default) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public Foo VarString { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varString = default; + Foo varString = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); - Option varStringParsedValue = new Option(varString.Value); - - return new FooGetDefaultResponse(varStringParsedValue); + return new FooGetDefaultResponse(varString); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - if (fooGetDefaultResponse.VarString.Value == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - - if (fooGetDefaultResponse.VarString.IsSet) - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index d60727736d3a..30a9b189932a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,11 +31,9 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// binary /// varByte /// date - /// number - /// password - /// binary /// dateTime /// varDecimal /// varDouble @@ -44,6 +41,8 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer + /// number + /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -52,13 +51,11 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) { + Binary = binary; VarByte = varByte; Date = date; - Number = number; - Password = password; - Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -66,6 +63,8 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password Int32 = int32; Int64 = int64; Integer = integer; + Number = number; + Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -78,6 +77,12 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password partial void OnCreated(); + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get; set; } + /// /// Gets or Sets VarByte /// @@ -91,112 +96,106 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password [JsonPropertyName("date")] public DateTime Date { get; set; } - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } - - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public Option Binary { get; set; } - /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public Option VarDecimal { get; set; } + public decimal VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public Option VarDouble { get; set; } + public double VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public Option VarFloat { get; set; } + public float VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public Option Int32 { get; set; } + public int Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public Option Int64 { get; set; } + public long Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public Option Integer { get; set; } + public int Integer { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public Option PatternWithBackslash { get; set; } + public string PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public Option PatternWithDigits { get; set; } + public string PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public Option PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public string VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public Option UnsignedInteger { get; set; } + public uint UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public Option UnsignedLong { get; set; } + public ulong UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets additional properties @@ -212,11 +211,9 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -224,6 +221,8 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -243,122 +242,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - // VarDouble (double) maximum - if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) + if (this.VarDouble > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) + if (this.VarDouble < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) + if (this.VarFloat > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) + if (this.VarFloat < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32.IsSet && this.Int32.Value > (int)200) + if (this.Int32 > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32.IsSet && this.Int32.Value < (int)20) + if (this.Int32 < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer.IsSet && this.Integer.Value > (int)100) + if (this.Integer > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer.IsSet && this.Integer.Value < (int)10) + if (this.Integer < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - if (this.PatternWithBackslash.Value != null) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits.Value != null) { + if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter.Value != null) { + if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString.Value != null) { + if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString.Value).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) + if (this.UnsignedInteger > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) + if (this.UnsignedInteger < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -399,25 +398,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varByte = default; - Option date = default; - Option number = default; - Option password = default; - Option binary = default; - Option dateTime = default; - Option varDecimal = default; - Option varDouble = default; - Option varFloat = default; - Option int32 = default; - Option int64 = default; - Option integer = default; - Option patternWithBackslash = default; - Option patternWithDigits = default; - Option patternWithDigitsAndDelimiter = default; - Option varString = default; - Option unsignedInteger = default; - Option unsignedLong = default; - Option uuid = default; + System.IO.Stream binary = default; + byte[] varByte = default; + DateTime? date = default; + DateTime? dateTime = default; + decimal? varDecimal = default; + double? varDouble = default; + float? varFloat = default; + int? int32 = default; + long? int64 = default; + int? integer = default; + decimal? number = default; + string password = default; + string patternWithBackslash = default; + string patternWithDigits = default; + string patternWithDigitsAndDelimiter = default; + string varString = default; + uint? unsignedInteger = default; + ulong? unsignedLong = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -434,76 +433,76 @@ 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)); - break; - case "date": + case "binary": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "number": + case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); - break; - case "password": - password = new Option(utf8JsonReader.GetString()); + varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "binary": + case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = utf8JsonReader.GetDouble(); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = (float)utf8JsonReader.GetDouble(); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = utf8JsonReader.GetInt32(); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = utf8JsonReader.GetInt64(); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = utf8JsonReader.GetInt32(); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = utf8JsonReader.GetDecimal(); + break; + case "password": + password = utf8JsonReader.GetString(); break; case "pattern_with_backslash": - patternWithBackslash = new Option(utf8JsonReader.GetString()); + patternWithBackslash = utf8JsonReader.GetString(); break; case "pattern_with_digits": - patternWithDigits = new Option(utf8JsonReader.GetString()); + patternWithDigits = utf8JsonReader.GetString(); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); + patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); break; case "string": - varString = new Option(utf8JsonReader.GetString()); + varString = utf8JsonReader.GetString(); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = utf8JsonReader.GetUInt32(); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = utf8JsonReader.GetUInt64(); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -511,96 +510,64 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (!varByte.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - - if (!date.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - - if (!number.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - - if (!password.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - - if (varByte.Value == null) - throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + if (binary == null) + throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - if (date.Value == null) - throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (number.Value == null) - throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + if (date == null) + throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); - if (binary.Value == null) - throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + if (varDecimal == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + if (varDouble == null) + throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); - if (varDecimal.Value == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); - if (varDouble.Value == null) - throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + if (int32 == null) + throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); - if (varFloat.Value == null) - throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + if (int64 == null) + throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); - if (int32.Value == null) - throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + if (integer == null) + throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); - if (int64.Value == null) - throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + if (number == null) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (integer.Value == null) - throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (patternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); - if (patternWithDigits.Value == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + if (patternWithDigits == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); - if (patternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + if (patternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); - if (unsignedInteger.Value == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + if (unsignedInteger == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); - if (unsignedLong.Value == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + if (unsignedLong == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); - byte[] varByteParsedValue = varByte.Value; - DateTime dateParsedValue = date.Value.Value; - decimal numberParsedValue = number.Value.Value; - string passwordParsedValue = password.Value; - Option binaryParsedValue = new Option(binary.Value); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option varDecimalParsedValue = new Option(varDecimal.Value.Value); - Option varDoubleParsedValue = new Option(varDouble.Value.Value); - Option varFloatParsedValue = new Option(varFloat.Value.Value); - Option int32ParsedValue = new Option(int32.Value.Value); - Option int64ParsedValue = new Option(int64.Value.Value); - Option integerParsedValue = new Option(integer.Value.Value); - Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); - Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); - Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); - Option varStringParsedValue = new Option(varString.Value); - Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); - Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - - return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); + return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); } /// @@ -627,49 +594,28 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.VarByte == null) - throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); - - if (formatTest.Password == null) - throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); - - if (formatTest.Binary.Value == null) - throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); - - if (formatTest.PatternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigits.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - - if (formatTest.VarString.Value == null) - throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); - + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); + writer.WriteNumber("float", formatTest.VarFloat); + writer.WriteNumber("int32", formatTest.Int32); + writer.WriteNumber("int64", formatTest.Int64); + writer.WriteNumber("integer", formatTest.Integer); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + writer.WriteString("string", formatTest.VarString); + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); + writer.WriteString("uuid", formatTest.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index 0ecd4f389c9f..2e05ffb958a4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color = default) + public Fruit(Apple apple, string color) { Apple = apple; Color = color; @@ -46,7 +45,7 @@ public Fruit(Apple apple, Option color = default) /// /// /// color - public Fruit(Banana banana, Option color = default) + public Fruit(Banana banana, string color) { Banana = banana; Color = color; @@ -69,7 +68,7 @@ public Fruit(Banana banana, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -117,7 +116,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string color = default; Apple apple = default; Banana banana = default; @@ -157,7 +156,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -165,16 +164,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - - Option colorParsedValue = new Option(color.Value); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); if (apple != null) - return new Fruit(apple, colorParsedValue); + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, colorParsedValue); + return new Fruit(banana, color); throw new JsonException(); } @@ -203,11 +200,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs index 75652a1b436e..aa26d3600c05 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index e46437a88bc5..3c2d1ecefc94 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Option apple, Option banana, Option color = default) + public GmFruit(Apple apple, Banana banana, string color) { Apple = apple; Banana = banana; @@ -48,18 +47,18 @@ public GmFruit(Option apple, Option banana, Option color /// /// Gets or Sets Apple /// - public Option Apple { get; set; } + public Apple Apple { get; set; } /// /// Gets or Sets Banana /// - public Option Banana { get; set; } + public Banana Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -107,7 +106,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string color = default; Apple apple = default; Banana banana = default; @@ -147,7 +146,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -155,15 +154,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); - Option colorParsedValue = new Option(color.Value); - - Option appleParsedValue = new Option(apple); - Option bananaParsedValue = new Option(banana); - - return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); + return new GmFruit(apple, banana, color); } /// @@ -177,16 +171,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) + if (gmFruit.Apple != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); } - if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) + if (gmFruit.Banana != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -202,11 +196,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - if (gmFruit.Color.Value == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); - - if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value); + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7f03cc930b02..7ae4662ed8d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,7 +110,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -129,7 +128,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()); + petType = utf8JsonReader.GetString(); break; default: break; @@ -137,15 +136,10 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - - string petTypeParsedValue = petType.Value; - - return new GrandparentAnimal(petTypeParsedValue); + return new GrandparentAnimal(petType); } /// @@ -172,9 +166,6 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - if (grandparentAnimal.PetType == null) - throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 754c25d5eea7..31360d73f754 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(Option bar = default, Option foo = default) + internal HasOnlyReadOnly(string bar, string foo) { Bar = bar; Foo = foo; @@ -48,13 +47,13 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public Option Foo { get; } + public string Foo { get; } /// /// Gets or Sets additional properties @@ -147,8 +146,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option foo = default; + string bar = default; + string foo = default; while (utf8JsonReader.Read()) { @@ -166,10 +165,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; case "foo": - foo = new Option(utf8JsonReader.GetString()); + foo = utf8JsonReader.GetString(); break; default: break; @@ -177,16 +176,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); - if (foo.Value == null) - throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + if (foo == null) + throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); - Option barParsedValue = new Option(bar.Value); - Option fooParsedValue = new Option(foo.Value); - - return new HasOnlyReadOnly(barParsedValue, fooParsedValue); + return new HasOnlyReadOnly(bar, foo); } /// @@ -213,15 +209,8 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - if (hasOnlyReadOnly.Bar.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Foo.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); + writer.WriteString("bar", hasOnlyReadOnly.Bar); + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 82ddf5d26c2a..8355d97fa097 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(Option nullableMessage = default) + public HealthCheckResult(string nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -46,7 +45,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public Option NullableMessage { get; set; } + public string NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option nullableMessage = default; + string nullableMessage = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = new Option(utf8JsonReader.GetString()); + nullableMessage = utf8JsonReader.GetString(); break; default: break; @@ -154,11 +153,7 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - if (healthCheckResult.NullableMessage.IsSet) - if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); - else - writer.WriteNull("NullableMessage"); + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index e23d0ddf0c0e..0355613042f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,8 +102,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -122,10 +121,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -133,22 +132,13 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new IsoscelesTriangle(shapeType, triangleType); } /// @@ -175,13 +165,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (isoscelesTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); - - if (isoscelesTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index aaace3024a91..42b0c9cb2cf1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(Option var123List = default) + public List(string var123List) { Var123List = var123List; OnCreated(); @@ -46,7 +45,7 @@ public List(Option var123List = default) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public Option Var123List { get; set; } + public string Var123List { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option var123List = default; + string var123List = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = new Option(utf8JsonReader.GetString()); + var123List = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List.Value == null) - throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + if (var123List == null) + throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); - Option var123ListParsedValue = new Option(var123List.Value); - - return new List(var123ListParsedValue); + return new List(var123List); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - if (list.Var123List.Value == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); - - if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value); + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index c133271c04c0..0ad8832af885 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -48,13 +47,13 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public Option EscapedLiteralString { get; set; } + public string EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public Option UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option escapedLiteralString = default; - Option unescapedLiteralString = default; + string escapedLiteralString = default; + string unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = new Option(utf8JsonReader.GetString()); + escapedLiteralString = utf8JsonReader.GetString(); break; case "unescapedLiteralString": - unescapedLiteralString = new Option(utf8JsonReader.GetString()); + unescapedLiteralString = utf8JsonReader.GetString(); break; default: break; @@ -140,16 +139,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); - if (unescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); - Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); - Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); - - return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -176,15 +172,8 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - if (literalStringClass.EscapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.UnescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 4b47f18e5ac7..92011ad0e1d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -151,7 +150,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; Pig pig = null; Whale whale = null; @@ -208,7 +207,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -216,22 +215,17 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Mammal.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); if (pig != null) - return new Mammal(pig, classNameParsedValue); + return new Mammal(pig, className); if (whale != null) - return new Mammal(whale, classNameParsedValue); + return new Mammal(whale, className); if (zebra != null) - return new Mammal(zebra, classNameParsedValue); + return new Mammal(zebra, className); throw new JsonException(); } @@ -275,9 +269,6 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - if (mammal.ClassName == null) - throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index 6a9e14232f95..a4fdf221e931 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) { DirectMap = directMap; IndirectMap = indirectMap; @@ -105,6 +104,7 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { + if (value == InnerEnum.UPPER) return "UPPER"; @@ -118,25 +118,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Option> DirectMap { get; set; } + public Dictionary DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Option> IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Option>> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Option> MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -194,10 +194,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> directMap = default; - Option> indirectMap = default; - Option>> mapMapOfString = default; - Option> mapOfEnumString = default; + Dictionary directMap = default; + Dictionary indirectMap = default; + Dictionary> mapMapOfString = default; + Dictionary mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -216,19 +216,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -236,24 +236,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap.Value == null) - throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - - if (indirectMap.Value == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + if (directMap == null) + throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); - if (mapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + if (indirectMap == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); - if (mapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + if (mapMapOfString == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); - Option> directMapParsedValue = new Option>(directMap.Value); - Option> indirectMapParsedValue = new Option>(indirectMap.Value); - Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); - Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + if (mapOfEnumString == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); - return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -280,30 +275,14 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - if (mapTest.DirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); - - if (mapTest.IndirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); - - if (mapTest.MapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); - - if (mapTest.MapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - - if (mapTest.DirectMap.IsSet) - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMap.IsSet) - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfString.IsSet) - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumString.IsSet) - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index eebbb305b63d..0ed70f02c2db 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) { DateTime = dateTime; Map = map; @@ -52,25 +51,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = d /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Option> Map { get; set; } + public Dictionary Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Option UuidWithPattern { get; set; } + public Guid UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +103,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -139,10 +138,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateTime = default; - Option> map = default; - Option uuid = default; - Option uuidWithPattern = default; + DateTime? dateTime = default; + Dictionary map = default; + Guid? uuid = default; + Guid? uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -161,19 +160,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = utf8JsonReader.GetGuid(); break; default: break; @@ -181,24 +180,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map.Value == null) - throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map == null) + throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern.Value == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option> mapParsedValue = new Option>(map.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); - - return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); } /// @@ -225,16 +219,11 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 65f28e93b433..7969b9ae04ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(Option varClass = default, Option name = default) + public Model200Response(string varClass, int name) { VarClass = varClass; Name = name; @@ -48,13 +47,13 @@ public Model200Response(Option varClass = default, Option name = de /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public int Name { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; - Option name = default; + string varClass = default; + int? name = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = new Option(utf8JsonReader.GetString()); + varClass = utf8JsonReader.GetString(); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = utf8JsonReader.GetInt32(); break; default: break; @@ -141,16 +140,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); - Option varClassParsedValue = new Option(varClass.Value); - Option nameParsedValue = new Option(name.Value.Value); - - return new Model200Response(varClassParsedValue, nameParsedValue); + return new Model200Response(varClass, name.Value); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - if (model200Response.VarClass.Value == null) - throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) - writer.WriteNumber("name", model200Response.Name.Value); + writer.WriteString("class", model200Response.VarClass); + writer.WriteNumber("name", model200Response.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index e8a6cc98c5cc..810a6a01b8e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(Option varClient = default) + public ModelClient(string varClient) { VarClient = varClient; OnCreated(); @@ -46,7 +45,7 @@ public ModelClient(Option varClient = default) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public Option VarClient { get; set; } + public string VarClient { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClient = default; + string varClient = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = new Option(utf8JsonReader.GetString()); + varClient = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient.Value == null) - throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + if (varClient == null) + throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); - Option varClientParsedValue = new Option(varClient.Value); - - return new ModelClient(varClientParsedValue); + return new ModelClient(varClient); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - if (modelClient.VarClient.Value == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); - - if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value); + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index fed1dea8b9fe..edcb6b3403c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + public Name(int varName, string property, int snakeCase, int var123Number) { VarName = varName; Property = property; @@ -58,19 +57,19 @@ public Name(int varName, Option property = default, Option snakeCas /// Gets or Sets Property /// [JsonPropertyName("property")] - public Option Property { get; set; } + public string Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public Option SnakeCase { get; } + public int SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public Option Var123Number { get; } + public int Var123Number { get; } /// /// Gets or Sets additional properties @@ -165,10 +164,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varName = default; - Option property = default; - Option snakeCase = default; - Option var123Number = default; + int? varName = default; + string property = default; + int? snakeCase = default; + int? var123Number = default; while (utf8JsonReader.Read()) { @@ -187,18 +186,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = utf8JsonReader.GetInt32(); break; case "property": - property = new Option(utf8JsonReader.GetString()); + property = utf8JsonReader.GetString(); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = utf8JsonReader.GetInt32(); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = utf8JsonReader.GetInt32(); break; default: break; @@ -206,27 +205,19 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!varName.IsSet) - throw new ArgumentException("Property is required for class Name.", nameof(varName)); + if (varName == null) + throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (varName.Value == null) - throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + if (property == null) + throw new ArgumentNullException(nameof(property), "Property is required for class Name."); - if (property.Value == null) - throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + if (snakeCase == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); - if (snakeCase.Value == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + if (var123Number == null) + throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); - if (var123Number.Value == null) - throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - - int varNameParsedValue = varName.Value.Value; - Option propertyParsedValue = new Option(property.Value); - Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); - Option var123NumberParsedValue = new Option(var123Number.Value.Value); - - return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); + return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); } /// @@ -253,13 +244,10 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - if (name.Property.Value == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - - writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) - writer.WriteNumber("123Number", name.Var123Number.Value); + writer.WriteNumber("name", name.VarName); + writer.WriteString("property", name.Property); + writer.WriteNumber("snake_case", name.SnakeCase); + writer.WriteNumber("123Number", name.Var123Number); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 867c76a641df..83ab7f40b1e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> aObjVariableobject = default; - Option pkiNotificationtestID = default; + List> aObjVariableobject = default; + int? pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = utf8JsonReader.GetInt32(); break; default: break; @@ -142,22 +141,13 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (!aObjVariableobject.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + if (aObjVariableobject == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (!pkiNotificationtestID.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + if (pkiNotificationtestID == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (aObjVariableobject.Value == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - if (pkiNotificationtestID.Value == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - List> aObjVariableobjectParsedValue = aObjVariableobject.Value; - int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; - - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); } /// @@ -184,9 +174,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { - if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) - throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 12a42a0308fe..5d9de18c4a36 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +44,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -68,73 +67,73 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonPropertyName("array_items_nullable")] - public Option> ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Option> ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public Option> ArrayAndItemsNullableProp { get; set; } + public List ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public Option> ArrayNullableProp { get; set; } + public List ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public Option BooleanProp { get; set; } + public bool? BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public Option DateProp { get; set; } + public DateTime? DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public Option DatetimeProp { get; set; } + public DateTime? DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public Option IntegerProp { get; set; } + public int? IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public Option NumberProp { get; set; } + public decimal? NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Option> ObjectAndItemsNullableProp { get; set; } + public Dictionary ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Option> ObjectNullableProp { get; set; } + public Dictionary ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public Option StringProp { get; set; } + public string StringProp { get; set; } /// /// Gets or Sets additional properties @@ -221,18 +220,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayItemsNullable = default; - Option> objectItemsNullable = default; - Option> arrayAndItemsNullableProp = default; - Option> arrayNullableProp = default; - Option booleanProp = default; - Option dateProp = default; - Option datetimeProp = default; - Option integerProp = default; - Option numberProp = default; - Option> objectAndItemsNullableProp = default; - Option> objectNullableProp = default; - Option stringProp = default; + List arrayItemsNullable = default; + Dictionary objectItemsNullable = default; + List arrayAndItemsNullableProp = default; + List arrayNullableProp = default; + bool? booleanProp = default; + DateTime? dateProp = default; + DateTime? datetimeProp = default; + int? integerProp = default; + decimal? numberProp = default; + Dictionary objectAndItemsNullableProp = default; + Dictionary objectNullableProp = default; + string stringProp = default; while (utf8JsonReader.Read()) { @@ -251,50 +250,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = utf8JsonReader.GetBoolean(); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = utf8JsonReader.GetInt32(); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = utf8JsonReader.GetDecimal(); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "string_prop": - stringProp = new Option(utf8JsonReader.GetString()); + stringProp = utf8JsonReader.GetString(); break; default: break; @@ -302,16 +301,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + if (arrayItemsNullable == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); - if (objectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + if (objectItemsNullable == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); - Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); - Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); - - return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -338,75 +334,45 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableClass.ArrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ObjectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ArrayItemsNullable.IsSet) - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullable.IsSet) - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullableProp.IsSet) - if (nullableClass.ArrayAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullableProp.IsSet) - if (nullableClass.ArrayNullableProp.Value != null) - { - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) - if (nullableClass.ObjectAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullableProp.IsSet) - if (nullableClass.ObjectNullableProp.Value != null) - { - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else - writer.WriteNull("string_prop"); + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + + if (nullableClass.BooleanProp != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DateProp != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimeProp != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerProp != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberProp != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); + else + writer.WriteNull("number_prop"); + + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 6630472d83cb..684109acd50f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Option uuid = default) + public NullableGuidClass(Guid? uuid = default) { Uuid = uuid; OnCreated(); @@ -47,7 +46,7 @@ public NullableGuidClass(Option uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid? Uuid { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +101,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option uuid = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -156,11 +155,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid.IsSet) - if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); - else - writer.WriteNull("uuid"); + + if (nullableGuidClass.Uuid == null) + writer.WriteNull("uuid"); + else + writer.WriteString("uuid", nullableGuidClass.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index b9a9262817dc..a44c950b81bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeTypeParsedValue); + return new NullableShape(quadrilateral, shapeType); if (triangle != null) - return new NullableShape(triangle, shapeTypeParsedValue); + return new NullableShape(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - if (nullableShape.ShapeType == null) - throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index c54ed6a54175..3f3cbf4c5059 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(Option justNumber = default) + public NumberOnly(decimal justNumber) { JustNumber = justNumber; OnCreated(); @@ -46,7 +45,7 @@ public NumberOnly(Option justNumber = default) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public Option JustNumber { get; set; } + public decimal JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option justNumber = default; + decimal? justNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = utf8JsonReader.GetDecimal(); break; default: break; @@ -128,12 +127,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber.Value == null) - throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + if (justNumber == null) + throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); - Option justNumberParsedValue = new Option(justNumber.Value.Value); - - return new NumberOnly(justNumberParsedValue); + return new NumberOnly(justNumber.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (numberOnly.JustNumber.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); + writer.WriteNumber("JustNumber", numberOnly.JustNumber); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 01afc19a7190..57a1614f29f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -53,27 +52,27 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonPropertyName("bars")] [Obsolete] - public Option> Bars { get; set; } + public List Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public Option DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public Option Id { get; set; } + public decimal Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public string Uuid { get; set; } /// /// Gets or Sets additional properties @@ -131,10 +130,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> bars = default; - Option deprecatedRef = default; - Option id = default; - Option uuid = default; + List bars = default; + DeprecatedObject deprecatedRef = default; + decimal? id = default; + string uuid = default; while (utf8JsonReader.Read()) { @@ -153,18 +152,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = utf8JsonReader.GetDecimal(); break; case "uuid": - uuid = new Option(utf8JsonReader.GetString()); + uuid = utf8JsonReader.GetString(); break; default: break; @@ -172,24 +171,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars.Value == null) - throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (bars == null) + throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); - if (deprecatedRef.Value == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (deprecatedRef == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); - Option> barsParsedValue = new Option>(bars.Value); - Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); - Option idParsedValue = new Option(id.Value.Value); - Option uuidParsedValue = new Option(uuid.Value); - - return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); } /// @@ -216,24 +210,12 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - if (objectWithDeprecatedFields.Bars.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.DeprecatedRef.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Uuid.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Bars.IsSet) - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRef.IsSet) - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs index 660604e3ef17..91dd67631614 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index 68bd7eae6f50..3258ff154478 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) { Id = id; PetId = petId; @@ -121,6 +120,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Placed) return "placed"; @@ -138,38 +138,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public Option PetId { get; set; } + public long PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public Option Quantity { get; set; } + public int Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public Option ShipDate { get; set; } + public DateTime ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public Option Complete { get; set; } + public bool Complete { get; set; } /// /// Gets or Sets additional properties @@ -234,12 +234,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option petId = default; - Option quantity = default; - Option shipDate = default; - Option status = default; - Option complete = default; + long? id = default; + long? petId = default; + int? quantity = default; + DateTime? shipDate = default; + Order.StatusEnum? status = default; + bool? complete = default; while (utf8JsonReader.Read()) { @@ -258,28 +258,29 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = utf8JsonReader.GetInt64(); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = utf8JsonReader.GetInt32(); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Order.StatusEnumFromStringOrDefault(statusRawValue); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = utf8JsonReader.GetBoolean(); break; default: break; @@ -287,32 +288,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - - if (petId.Value == null) - throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Order."); - if (quantity.Value == null) - throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + if (petId == null) + throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); - if (shipDate.Value == null) - throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + if (quantity == null) + throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + if (shipDate == null) + throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); - if (complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Order."); - Option idParsedValue = new Option(id.Value.Value); - Option petIdParsedValue = new Option(petId.Value.Value); - Option quantityParsedValue = new Option(quantity.Value.Value); - Option shipDateParsedValue = new Option(shipDate.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option completeParsedValue = new Option(complete.Value.Value); + if (complete == null) + throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); - return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); + return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); } /// @@ -339,18 +333,18 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + writer.WriteNumber("id", order.Id); + writer.WriteNumber("petId", order.PetId); + writer.WriteNumber("quantity", order.Quantity); + writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) - writer.WriteBoolean("complete", order.Complete.Value); + writer.WriteBoolean("complete", order.Complete); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 94decb7debbd..c37883db124b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + public OuterComposite(bool myBoolean, decimal myNumber, string myString) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -50,19 +49,19 @@ public OuterComposite(Option myBoolean = default, Option myNumber /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public Option MyBoolean { get; set; } + public bool MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public Option MyNumber { get; set; } + public decimal MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public Option MyString { get; set; } + public string MyString { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option myBoolean = default; - Option myNumber = default; - Option myString = default; + bool? myBoolean = default; + decimal? myNumber = default; + string myString = default; while (utf8JsonReader.Read()) { @@ -140,14 +139,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = utf8JsonReader.GetBoolean(); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = utf8JsonReader.GetDecimal(); break; case "my_string": - myString = new Option(utf8JsonReader.GetString()); + myString = utf8JsonReader.GetString(); break; default: break; @@ -155,20 +154,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean.Value == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + if (myBoolean == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); - if (myNumber.Value == null) - throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + if (myNumber == null) + throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); - if (myString.Value == null) - throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + if (myString == null) + throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); - Option myBooleanParsedValue = new Option(myBoolean.Value.Value); - Option myNumberParsedValue = new Option(myNumber.Value.Value); - Option myStringParsedValue = new Option(myString.Value); - - return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); + return new OuterComposite(myBoolean.Value, myNumber.Value, myString); } /// @@ -195,13 +190,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - if (outerComposite.MyString.Value == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value); + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); + writer.WriteNumber("my_number", outerComposite.MyNumber); + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs index 47bb6793c6ac..a4ec335bb386 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 136fb4c54c4e..7c67db5ddca3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 2ed4f18a657e..84ea65297ab0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index c6a470cc64d1..983d194a1998 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index a2e789f2edef..51d8bee407e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index eed898ba2b31..eb0129c6ce0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -77,7 +76,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -95,7 +94,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()); + petType = utf8JsonReader.GetString(); break; default: break; @@ -103,15 +102,10 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - - string petTypeParsedValue = petType.Value; - - return new ParentPet(petTypeParsedValue); + return new ParentPet(petType); } /// @@ -138,9 +132,6 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - if (parentPet.PetType == null) - throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 226f77e03009..225a9c5328c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,19 +31,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name - /// photoUrls /// category /// id + /// name + /// photoUrls /// pet status in the store /// tags [JsonConstructor] - public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) { - Name = name; - PhotoUrls = photoUrls; Category = category; Id = id; + Name = name; + PhotoUrls = photoUrls; Status = status; Tags = tags; OnCreated(); @@ -121,6 +120,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Available) return "available"; @@ -138,7 +138,19 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long Id { get; set; } /// /// Gets or Sets Name @@ -153,23 +165,11 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Option Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public Option> Tags { get; set; } + public List Tags { get; set; } /// /// Gets or Sets additional properties @@ -185,10 +185,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -229,12 +229,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option> photoUrls = default; - Option category = default; - Option id = default; - Option status = default; - Option> tags = default; + Category category = default; + long? id = default; + string name = default; + List photoUrls = default; + Pet.StatusEnum? status = default; + List tags = default; while (utf8JsonReader.Read()) { @@ -251,29 +251,30 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; - case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Pet.StatusEnumFromStringOrDefault(statusRawValue); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -281,38 +282,25 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(name)); - - if (!photoUrls.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + if (category == null) + throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - if (photoUrls.Value == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - if (category.Value == null) - throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + if (photoUrls == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); - if (tags.Value == null) - throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + if (tags == null) + throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); - string nameParsedValue = name.Value; - List photoUrlsParsedValue = photoUrls.Value; - Option categoryParsedValue = new Option(category.Value); - Option idParsedValue = new Option(id.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option> tagsParsedValue = new Option>(tags.Value); - - return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); + return new Pet(category, id.Value, name, photoUrls, status.Value, tags); } /// @@ -339,33 +327,21 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - if (pet.Name == null) - throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); - - if (pet.PhotoUrls == null) - throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); - - if (pet.Category.Value == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - - if (pet.Tags.Value == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - - writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - if (pet.Category.IsSet) - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.Tags.IsSet) - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index 25983ae01515..8185d643e794 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -185,7 +184,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Pig.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); if (basquePig != null) - return new Pig(basquePig, classNameParsedValue); + return new Pig(basquePig, className); if (danishPig != null) - return new Pig(danishPig, classNameParsedValue); + return new Pig(danishPig, className); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - if (pig.ClassName == null) - throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 2c2227a22512..3a89a8716e07 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 07e96cf8bb56..65f7b8b4536f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -185,7 +184,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); - - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(complexQuadrilateral, quadrilateralType); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 0804077cd4c8..c329eed3266b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - - return new QuadrilateralInterface(quadrilateralTypeParsedValue); + return new QuadrilateralInterface(quadrilateralType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateralInterface.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 5acfdc25b589..2c8b4fff43d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(Option bar = default, Option baz = default) + public ReadOnlyFirst(string bar, string baz) { Bar = bar; Baz = baz; @@ -48,13 +47,13 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public Option Baz { get; set; } + public string Baz { get; set; } /// /// Gets or Sets additional properties @@ -146,8 +145,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option baz = default; + string bar = default; + string baz = default; while (utf8JsonReader.Read()) { @@ -165,10 +164,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; case "baz": - baz = new Option(utf8JsonReader.GetString()); + baz = utf8JsonReader.GetString(); break; default: break; @@ -176,16 +175,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); - if (baz.Value == null) - throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + if (baz == null) + throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); - Option barParsedValue = new Option(bar.Value); - Option bazParsedValue = new Option(baz.Value); - - return new ReadOnlyFirst(barParsedValue, bazParsedValue); + return new ReadOnlyFirst(bar, baz); } /// @@ -212,15 +208,8 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - if (readOnlyFirst.Bar.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Baz.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value); + writer.WriteString("bar", readOnlyFirst.Bar); + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 6ae20bbe399f..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,2202 +0,0 @@ -// -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - public partial class RequiredClass : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// requiredNotNullableDateProp - /// requiredNotnullableArrayOfString - /// requiredNotnullableBooleanProp - /// requiredNotnullableDatetimeProp - /// requiredNotnullableEnumInteger - /// requiredNotnullableEnumIntegerOnly - /// requiredNotnullableEnumString - /// requiredNotnullableOuterEnumDefaultValue - /// requiredNotnullableStringProp - /// requiredNotnullableUuid - /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid - /// requiredNullableArrayOfString - /// requiredNullableBooleanProp - /// requiredNullableDateProp - /// requiredNullableDatetimeProp - /// requiredNullableEnumInteger - /// requiredNullableEnumIntegerOnly - /// requiredNullableEnumString - /// requiredNullableIntegerProp - /// requiredNullableOuterEnumDefaultValue - /// requiredNullableStringProp - /// requiredNullableUuid - /// notRequiredNullableDateProp - /// notRequiredNullableIntegerProp - /// notrequiredNullableArrayOfString - /// notrequiredNullableBooleanProp - /// notrequiredNullableDatetimeProp - /// notrequiredNullableEnumInteger - /// notrequiredNullableEnumIntegerOnly - /// notrequiredNullableEnumString - /// notrequiredNullableOuterEnumDefaultValue - /// notrequiredNullableStringProp - /// notrequiredNullableUuid - [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) - { - RequiredNotNullableDateProp = requiredNotNullableDateProp; - RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - RequiredNotnullableEnumString = requiredNotnullableEnumString; - RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - RequiredNotnullableStringProp = requiredNotnullableStringProp; - RequiredNotnullableUuid = requiredNotnullableUuid; - RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - RequiredNullableArrayOfString = requiredNullableArrayOfString; - RequiredNullableBooleanProp = requiredNullableBooleanProp; - RequiredNullableDateProp = requiredNullableDateProp; - RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - RequiredNullableEnumInteger = requiredNullableEnumInteger; - RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - RequiredNullableEnumString = requiredNullableEnumString; - RequiredNullableIntegerProp = requiredNullableIntegerProp; - RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - RequiredNullableStringProp = requiredNullableStringProp; - RequiredNullableUuid = requiredNullableUuid; - NotRequiredNullableDateProp = notRequiredNullableDateProp; - NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - NotrequiredNullableEnumString = notrequiredNullableEnumString; - NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - NotrequiredNullableStringProp = notrequiredNullableStringProp; - NotrequiredNullableUuid = notrequiredNullableUuid; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNotnullableEnumString - /// - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) - { - if (value == RequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public Option NotrequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumString - /// - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) - { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public Option NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } - - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNullableEnumString - /// - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [JsonPropertyName("notrequired_nullable_enum_integer")] - public Option NotrequiredNullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public Option NotrequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNullableEnumString - /// - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == NotrequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [JsonPropertyName("notrequired_nullable_enum_string")] - public Option NotrequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public Option NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public Option NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public Option> NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public Option NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public Option NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public Option NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Option NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [JsonPropertyName("not_required_nullable_date_prop")] - public Option NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public Option NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [JsonPropertyName("notrequired_nullable_array_of_string")] - public Option> NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [JsonPropertyName("notrequired_nullable_boolean_prop")] - public Option NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [JsonPropertyName("notrequired_nullable_datetime_prop")] - public Option NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [JsonPropertyName("notrequired_nullable_string_prop")] - public Option NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_nullable_uuid")] - public Option NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; } = new Dictionary(); - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class RequiredClassJsonConverter : JsonConverter - { - /// - /// The format to use to serialize RequiredNotNullableDateProp - /// - public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNotnullableDatetimeProp - /// - public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize RequiredNullableDateProp - /// - public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNullableDatetimeProp - /// - public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNullableDateProp - /// - public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNullableDatetimeProp - /// - public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option requiredNotNullableDateProp = default; - Option> requiredNotnullableArrayOfString = default; - Option requiredNotnullableBooleanProp = default; - Option requiredNotnullableDatetimeProp = default; - Option requiredNotnullableEnumInteger = default; - Option requiredNotnullableEnumIntegerOnly = default; - Option requiredNotnullableEnumString = default; - Option requiredNotnullableOuterEnumDefaultValue = default; - Option requiredNotnullableStringProp = default; - Option requiredNotnullableUuid = default; - Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; - Option> requiredNullableArrayOfString = default; - Option requiredNullableBooleanProp = default; - Option requiredNullableDateProp = default; - Option requiredNullableDatetimeProp = default; - Option requiredNullableEnumInteger = default; - Option requiredNullableEnumIntegerOnly = default; - Option requiredNullableEnumString = default; - Option requiredNullableIntegerProp = default; - Option requiredNullableOuterEnumDefaultValue = default; - Option requiredNullableStringProp = default; - Option requiredNullableUuid = default; - Option notRequiredNullableDateProp = default; - Option notRequiredNullableIntegerProp = default; - Option> notrequiredNullableArrayOfString = default; - Option notrequiredNullableBooleanProp = default; - Option notrequiredNullableDatetimeProp = default; - Option notrequiredNullableEnumInteger = default; - Option notrequiredNullableEnumIntegerOnly = default; - Option notrequiredNullableEnumString = default; - Option notrequiredNullableOuterEnumDefaultValue = default; - Option notrequiredNullableStringProp = default; - Option notrequiredNullableUuid = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_notnullable_enum_string": - string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableEnumStringRawValue != null) - requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); - break; - case "required_notnullable_outerEnumDefaultValue": - string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableOuterEnumDefaultValueRawValue != null) - requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "required_notnullable_string_prop": - requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_string": - string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNullableEnumStringRawValue != null) - requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); - break; - case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "required_nullable_outerEnumDefaultValue": - string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); - break; - case "required_nullable_string_prop": - requiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_nullable_enum_string": - string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableEnumStringRawValue != null) - notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); - break; - case "notrequired_nullable_outerEnumDefaultValue": - string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableOuterEnumDefaultValueRawValue != null) - notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_nullable_string_prop": - notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - default: - break; - } - } - } - - if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); - - if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); - - if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); - - if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); - - if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); - - if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); - - if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); - - if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); - - if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); - - if (!requiredNotnullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); - - if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); - - if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); - - if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); - - if (!requiredNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); - - if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); - - if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); - - if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); - - if (!requiredNullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); - - if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); - - if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); - - if (!requiredNullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); - - if (!requiredNullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); - - if (requiredNotNullableDateProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableDateProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; - List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; - bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; - DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; - RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; - OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; - string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; - Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; - int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; - Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); - Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); - Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); - Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); - Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); - Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); - Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); - Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); - Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); - Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); - Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); - List requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; - bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; - DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; - DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; - RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; - RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; - RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; - int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; - OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; - string requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; - Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; - - return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(ref writer, requiredClass, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - if (requiredClass.RequiredNotnullableArrayOfString == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.RequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); - if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); - else - writer.WriteNull("required_notnullable_enum_string"); - - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) - { - writer.WritePropertyName("required_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); - if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); - else - writer.WriteNull("required_nullable_enum_string"); - - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - else - { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); - else - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - } - - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) - if (requiredClass.NotrequiredNullableArrayOfString.Value != null) - { - writer.WritePropertyName("notrequired_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); - if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); - else - writer.WriteNull("notrequired_nullable_enum_string"); - - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) - { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); - writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); - } - else - writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else - writer.WriteNull("notrequired_nullable_uuid"); - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index 261fdb8d1758..86e7223ee957 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(Option varReturn = default) + public Return(int varReturn) { VarReturn = varReturn; OnCreated(); @@ -46,7 +45,7 @@ public Return(Option varReturn = default) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public Option VarReturn { get; set; } + public int VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varReturn = default; + int? varReturn = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = utf8JsonReader.GetInt32(); break; default: break; @@ -128,12 +127,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn.Value == null) - throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + if (varReturn == null) + throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); - Option varReturnParsedValue = new Option(varReturn.Value.Value); - - return new Return(varReturnParsedValue); + return new Return(varReturn.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.VarReturn.IsSet) - writer.WriteNumber("return", varReturn.VarReturn.Value); + writer.WriteNumber("return", varReturn.VarReturn); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 54b27bd0611e..86effcebe7ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(Option role = default, Option roleUuid = default) + public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) { Role = role; RoleUuid = roleUuid; @@ -48,13 +47,13 @@ public RolesReportsHash(Option role = default, Option [JsonPropertyName("role")] - public Option Role { get; set; } + public RolesReportsHashRole Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Option RoleUuid { get; set; } + public Guid RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option role = default; - Option roleUuid = default; + RolesReportsHashRole role = default; + Guid? roleUuid = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = utf8JsonReader.GetGuid(); break; default: break; @@ -142,16 +141,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role.Value == null) - throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + if (role == null) + throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); - if (roleUuid.Value == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + if (roleUuid == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); - Option roleParsedValue = new Option(role.Value); - Option roleUuidParsedValue = new Option(roleUuid.Value.Value); - - return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); + return new RolesReportsHash(role, roleUuid.Value); } /// @@ -178,14 +174,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHash.Role.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - - if (rolesReportsHash.Role.IsSet) - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index ef1ad83c5ac4..c7002b77b2e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(Option name = default) + public RolesReportsHashRole(string name) { Name = name; OnCreated(); @@ -46,7 +45,7 @@ public RolesReportsHashRole(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string name = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); - Option nameParsedValue = new Option(name.Value); - - return new RolesReportsHashRole(nameParsedValue); + return new RolesReportsHashRole(name); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHashRole.Name.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); - - if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value); + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 2252bd8cb94f..4151ead57dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new ScaleneTriangle(shapeType, triangleType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (scaleneTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); - - if (scaleneTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - - writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index a65c260c9efb..dae0ef02f966 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeTypeParsedValue); + return new Shape(quadrilateral, shapeType); if (triangle != null) - return new Shape(triangle, shapeTypeParsedValue); + return new Shape(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - if (shape.ShapeType == null) - throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 526250148c57..de32fa535aec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - - string shapeTypeParsedValue = shapeType.Value; - - return new ShapeInterface(shapeTypeParsedValue); + return new ShapeInterface(shapeType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - if (shapeInterface.ShapeType == null) - throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index ccfbe3817dea..955461e12024 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); + return new ShapeOrNull(quadrilateral, shapeType); if (triangle != null) - return new ShapeOrNull(triangle, shapeTypeParsedValue); + return new ShapeOrNull(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - if (shapeOrNull.ShapeType == null) - throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 29a0757f6a6c..7f0b8a306f80 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new SimpleQuadrilateral(quadrilateralType, shapeType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (simpleQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); - - if (simpleQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index ff962f637f2d..8328ad3ee121 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + public SpecialModelName(string varSpecialModelName, long specialPropertyName) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -48,13 +47,13 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonPropertyName("_special_model.name_")] - public Option VarSpecialModelName { get; set; } + public string VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public Option SpecialPropertyName { get; set; } + public long SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varSpecialModelName = default; - Option specialPropertyName = default; + string varSpecialModelName = default; + long? specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = new Option(utf8JsonReader.GetString()); + varSpecialModelName = utf8JsonReader.GetString(); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = utf8JsonReader.GetInt64(); break; default: break; @@ -141,16 +140,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + if (varSpecialModelName == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); - if (specialPropertyName.Value == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + if (specialPropertyName == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); - Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); - Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); - - return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); + return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - if (specialModelName.VarSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index 226c6f1e6fdf..6524d75edcf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(Option id = default, Option name = default) + public Tag(long id, string name) { Id = id; Name = name; @@ -48,13 +47,13 @@ public Tag(Option id = default, Option name = default) /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option name = default; + long? id = default; + string name = default; while (utf8JsonReader.Read()) { @@ -130,10 +129,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -141,16 +140,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); - Option idParsedValue = new Option(id.Value.Value); - Option nameParsedValue = new Option(name.Value); - - return new Tag(idParsedValue, nameParsedValue); + return new Tag(id.Value, name); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - if (tag.Name.Value == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value); + writer.WriteNumber("id", tag.Id); + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index f52b9e4a2b54..b2e110e79f67 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(Option value = default) + public TestCollectionEndingWithWordList(string value) { Value = value; OnCreated(); @@ -46,7 +45,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Gets or Sets Value /// [JsonPropertyName("value")] - public Option Value { get; set; } + public string Value { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option value = default; + string value = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = new Option(utf8JsonReader.GetString()); + value = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value.Value == null) - throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + if (value == null) + throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); - Option valueParsedValue = new Option(value.Value); - - return new TestCollectionEndingWithWordList(valueParsedValue); + return new TestCollectionEndingWithWordList(value); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordList.Value.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); - - if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 4227a82c141a..8753edfd9f35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -46,7 +45,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonPropertyName("TestCollectionEndingWithWordList")] - public Option> TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> testCollectionEndingWithWordList = default; + List testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); - - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 66ff4d3f740d..139e92b4c6a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() + public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() { SomeProperty = someProperty; OnCreated(); @@ -46,7 +45,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public Option SomeProperty { get; set; } + public string SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -112,7 +111,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option someProperty = default; + string someProperty = default; while (utf8JsonReader.Read()) { @@ -130,7 +129,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = new Option(utf8JsonReader.GetString()); + someProperty = utf8JsonReader.GetString(); break; default: break; @@ -138,12 +137,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty.Value == null) - throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty == null) + throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - Option somePropertyParsedValue = new Option(someProperty.Value); - - return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -170,11 +167,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index d3f217b6df34..814316961f91 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -151,7 +150,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -208,7 +207,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -216,22 +215,17 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); - - string triangleTypeParsedValue = triangleType.Value; + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleTypeParsedValue); + return new Triangle(equilateralTriangle, triangleType); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleTypeParsedValue); + return new Triangle(isoscelesTriangle, triangleType); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleTypeParsedValue); + return new Triangle(scaleneTriangle, triangleType); throw new JsonException(); } @@ -275,9 +269,6 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - if (triangle.TriangleType == null) - throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 728872627f36..6bd1e4303a70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - - string triangleTypeParsedValue = triangleType.Value; - - return new TriangleInterface(triangleTypeParsedValue); + return new TriangleInterface(triangleType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - if (triangleInterface.TriangleType == null) - throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index a274f3d6e631..ea527b94ec08 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +44,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -68,78 +67,78 @@ public User(Option email = default, Option firstName = default, /// Gets or Sets Email /// [JsonPropertyName("email")] - public Option Email { get; set; } + public string Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public Option FirstName { get; set; } + public string FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public Option LastName { get; set; } + public string LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Option ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public Option Password { get; set; } + public string Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public Option Phone { get; set; } + public string Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public Option UserStatus { get; set; } + public int UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public Option Username { get; set; } + public string Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Option AnyTypeProp { get; set; } + public Object AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Option AnyTypePropNullable { get; set; } + public Object AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Option ObjectWithNoDeclaredPropsNullable { get; set; } + public Object ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -205,18 +204,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option email = default; - Option firstName = default; - Option id = default; - Option lastName = default; - Option objectWithNoDeclaredProps = default; - Option password = default; - Option phone = default; - Option userStatus = default; - Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; + string email = default; + string firstName = default; + long? id = default; + string lastName = default; + Object objectWithNoDeclaredProps = default; + string password = default; + string phone = default; + int? userStatus = default; + string username = default; + Object anyTypeProp = default; + Object anyTypePropNullable = default; + Object objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -234,46 +233,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = new Option(utf8JsonReader.GetString()); + email = utf8JsonReader.GetString(); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()); + firstName = utf8JsonReader.GetString(); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()); + lastName = utf8JsonReader.GetString(); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "password": - password = new Option(utf8JsonReader.GetString()); + password = utf8JsonReader.GetString(); break; case "phone": - phone = new Option(utf8JsonReader.GetString()); + phone = utf8JsonReader.GetString(); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = utf8JsonReader.GetInt32(); break; case "username": - username = new Option(utf8JsonReader.GetString()); + username = utf8JsonReader.GetString(); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -281,44 +280,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email.Value == null) - throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + if (email == null) + throw new ArgumentNullException(nameof(email), "Property is required for class User."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class User."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); - if (objectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + if (objectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class User."); - if (phone.Value == null) - throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + if (phone == null) + throw new ArgumentNullException(nameof(phone), "Property is required for class User."); - if (userStatus.Value == null) - throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + if (userStatus == null) + throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); - if (username.Value == null) - throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + if (username == null) + throw new ArgumentNullException(nameof(username), "Property is required for class User."); - Option emailParsedValue = new Option(email.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option idParsedValue = new Option(id.Value.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); - Option passwordParsedValue = new Option(password.Value); - Option phoneParsedValue = new Option(phone.Value); - Option userStatusParsedValue = new Option(userStatus.Value.Value); - Option usernameParsedValue = new Option(username.Value); - - return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -345,62 +334,22 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - if (user.Email.Value == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); - - if (user.FirstName.Value == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); - - if (user.LastName.Value == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); - - if (user.ObjectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); - - if (user.Password.Value == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); - - if (user.Phone.Value == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); - - if (user.Username.Value == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) - if (user.AnyTypeProp.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullable.IsSet) - if (user.AnyTypePropNullable.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullable.IsSet) - if (user.ObjectWithNoDeclaredPropsNullable.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); + writer.WriteString("email", user.Email); + writer.WriteString("firstName", user.FirstName); + writer.WriteNumber("id", user.Id); + writer.WriteString("lastName", user.LastName); + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); + writer.WriteString("phone", user.Phone); + writer.WriteNumber("userStatus", user.UserStatus); + writer.WriteString("username", user.Username); + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index 37036ab1f126..e633a5c92cf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + public Whale(string className, bool hasBaleen, bool hasTeeth) { ClassName = className; HasBaleen = hasBaleen; @@ -56,13 +55,13 @@ public Whale(string className, Option hasBaleen = default, Option ha /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public Option HasBaleen { get; set; } + public bool HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public Option HasTeeth { get; set; } + public bool HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option hasBaleen = default; - Option hasTeeth = default; + string className = default; + bool? hasBaleen = default; + bool? hasTeeth = default; while (utf8JsonReader.Read()) { @@ -139,15 +138,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = utf8JsonReader.GetBoolean(); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = utf8JsonReader.GetBoolean(); break; default: break; @@ -155,23 +154,16 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Whale.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + if (hasBaleen == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); - if (hasBaleen.Value == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + if (hasTeeth == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); - if (hasTeeth.Value == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - - string classNameParsedValue = className.Value; - Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); - Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); - - return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); + return new Whale(className, hasBaleen.Value, hasTeeth.Value); } /// @@ -198,12 +190,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - if (whale.ClassName == null) - throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - - writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); + writer.WriteString("className", whale.ClassName); + writer.WriteBoolean("hasBaleen", whale.HasBaleen); + writer.WriteBoolean("hasTeeth", whale.HasTeeth); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 9099a6a39579..52135d8a3c51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, Option type = default) : base() + public Zebra(string className, TypeEnum type) : base() { ClassName = className; Type = type; @@ -112,6 +111,7 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { + if (value == TypeEnum.Plains) return "plains"; @@ -128,7 +128,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public TypeEnum Type { get; set; } /// /// Gets or Sets ClassName @@ -201,8 +201,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option type = default; + string className = default; + Zebra.TypeEnum? type = default; while (utf8JsonReader.Read()) { @@ -220,12 +220,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - if (typeRawValue != null) - type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + type = typeRawValue == null + ? null + : Zebra.TypeEnumFromStringOrDefault(typeRawValue); break; default: break; @@ -233,19 +234,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Zebra.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - string classNameParsedValue = className.Value; - Option typeParsedValue = new Option(type.Value.Value); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); - return new Zebra(classNameParsedValue, typeParsedValue); + return new Zebra(className, type.Value); } /// @@ -272,10 +267,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - if (zebra.ClassName == null) - throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); - writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 34a044fb8b13..20e184f02b2b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 042dcb1ca2ad..7e5f3cdafcca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(Option zeroBasedEnum = default) + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -99,6 +98,7 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { + if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -112,7 +112,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public Option ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -167,7 +167,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option zeroBasedEnum = default; + ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -186,8 +186,9 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - if (zeroBasedEnumRawValue != null) - zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + zeroBasedEnum = zeroBasedEnumRawValue == null + ? null + : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); break; default: break; @@ -195,12 +196,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum.Value == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - - Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); + return new ZeroBasedEnumClass(zeroBasedEnum.Value); } /// @@ -227,7 +226,8 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs index 17ce2890bdc5..663aecff33e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,17 +37,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index e55d68956190..93bfff98acc2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Adult : Person, IValidatableObject /// lastName /// type [JsonConstructor] - public Adult(Option> children = default, Option firstName = default, Option lastName = default, Option type = default) : base(firstName, lastName, type) + public Adult(List children, string firstName, string lastName, string type) : base(firstName, lastName, type) { Children = children; OnCreated(); @@ -51,7 +50,7 @@ public Adult(Option> children = default, Option firstName = /// Gets or Sets Children /// [JsonPropertyName("children")] - public Option> Children { get; set; } + public List Children { get; set; } /// /// Returns the string presentation of the object @@ -90,10 +89,10 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> children = default; - Option firstName = default; - Option lastName = default; - Option type = default; + List? children = default; + string? firstName = default; + string? lastName = default; + string? type = default; while (utf8JsonReader.Read()) { @@ -112,16 +111,16 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "children": if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + children = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = utf8JsonReader.GetString(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + lastName = utf8JsonReader.GetString(); break; case "$_type": - type = new Option(utf8JsonReader.GetString()!); + type = utf8JsonReader.GetString(); break; default: break; @@ -129,24 +128,19 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (children.Value == null) - throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult."); + if (children == null) + throw new ArgumentNullException(nameof(children), "Property is required for class Adult."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Adult."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class Adult."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class Adult."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Adult."); - Option> childrenParsedValue = new Option>(children.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option typeParsedValue = new Option(type.Value); - - return new Adult(childrenParsedValue, firstNameParsedValue, lastNameParsedValue, typeParsedValue); + return new Adult(children, firstName, lastName, type); } /// @@ -173,25 +167,11 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { - if (adult.Children.Value == null) - throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); - - if (adult.FirstName.Value == null) - throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); - - if (adult.LastName.Value == null) - throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); - - if (adult.Type.Value == null) - throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult."); - - if (adult.Children.IsSet) - writer.WritePropertyName("children"); - JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); - if (adult.FirstName.IsSet) - writer.WriteString("firstName", adult.FirstName.Value); if (adult.LastName.IsSet) - writer.WriteString("lastName", adult.LastName.Value); if (adult.Type.IsSet) - writer.WriteString("$_type", adult.Type.Value); + writer.WritePropertyName("children"); + JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + writer.WriteString("firstName", adult.FirstName); + writer.WriteString("lastName", adult.LastName); + writer.WriteString("$_type", adult.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index e7e6fd04c710..0814fec25b7a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,7 +39,7 @@ public partial class Child : Person, IValidatableObject /// type /// boosterSeat [JsonConstructor] - public Child(Option age = default, Option firstName = default, Option lastName = default, Option type = default, Option boosterSeat = default) : base(firstName, lastName, type) + public Child(int age, string firstName, string lastName, string type, bool boosterSeat) : base(firstName, lastName, type) { Age = age; BoosterSeat = boosterSeat; @@ -53,13 +52,13 @@ public Child(Option age = default, Option firstName = default, Opti /// Gets or Sets Age /// [JsonPropertyName("age")] - public Option Age { get; set; } + public int Age { get; set; } /// /// Gets or Sets BoosterSeat /// [JsonPropertyName("boosterSeat")] - public Option BoosterSeat { get; set; } + public bool BoosterSeat { get; set; } /// /// Returns the string presentation of the object @@ -99,11 +98,11 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option age = default; - Option firstName = default; - Option lastName = default; - Option type = default; - Option boosterSeat = default; + int? age = default; + string? firstName = default; + string? lastName = default; + string? type = default; + bool? boosterSeat = default; while (utf8JsonReader.Read()) { @@ -122,20 +121,20 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "age": if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = new Option(utf8JsonReader.GetInt32()); + age = utf8JsonReader.GetInt32(); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = utf8JsonReader.GetString(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + lastName = utf8JsonReader.GetString(); break; case "$_type": - type = new Option(utf8JsonReader.GetString()!); + type = utf8JsonReader.GetString(); break; case "boosterSeat": if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = new Option(utf8JsonReader.GetBoolean()); + boosterSeat = utf8JsonReader.GetBoolean(); break; default: break; @@ -143,28 +142,22 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (age.Value == null) - throw new ArgumentNullException(nameof(age), "Property is not nullable for class Child."); + if (age == null) + throw new ArgumentNullException(nameof(age), "Property is required for class Child."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Child."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class Child."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Child."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class Child."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Child."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Child."); - if (boosterSeat.Value == null) - throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child."); + if (boosterSeat == null) + throw new ArgumentNullException(nameof(boosterSeat), "Property is required for class Child."); - Option ageParsedValue = new Option(age.Value.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option typeParsedValue = new Option(type.Value); - Option boosterSeatParsedValue = new Option(boosterSeat.Value.Value); - - return new Child(ageParsedValue, firstNameParsedValue, lastNameParsedValue, typeParsedValue, boosterSeatParsedValue); + return new Child(age.Value, firstName, lastName, type, boosterSeat.Value); } /// @@ -191,21 +184,11 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { - if (child.FirstName.Value == null) - throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); - - if (child.LastName.Value == null) - throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); - - if (child.Type.Value == null) - throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child."); - - if (child.Age.IsSet) - writer.WriteNumber("age", child.Age.Value); if (child.FirstName.IsSet) - writer.WriteString("firstName", child.FirstName.Value); if (child.LastName.IsSet) - writer.WriteString("lastName", child.LastName.Value); if (child.Type.IsSet) - writer.WriteString("$_type", child.Type.Value); if (child.BoosterSeat.IsSet) - writer.WriteBoolean("boosterSeat", child.BoosterSeat.Value); + writer.WriteNumber("age", child.Age); + writer.WriteString("firstName", child.FirstName); + writer.WriteString("lastName", child.LastName); + writer.WriteString("$_type", child.Type); + writer.WriteBoolean("boosterSeat", child.BoosterSeat); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index 0d372a97b170..150e974367e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,7 +37,7 @@ public partial class Person : IValidatableObject /// lastName /// type [JsonConstructor] - public Person(Option firstName = default, Option lastName = default, Option type = default) + public Person(string firstName, string lastName, string type) { FirstName = firstName; LastName = lastName; @@ -52,19 +51,19 @@ public Person(Option firstName = default, Option lastName = defa /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public Option FirstName { get; set; } + public string FirstName { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public Option LastName { get; set; } + public string LastName { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("$_type")] - public Option Type { get; set; } + public string Type { get; set; } /// /// Gets or Sets additional properties @@ -131,9 +130,9 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option firstName = default; - Option lastName = default; - Option type = default; + string? firstName = default; + string? lastName = default; + string? type = default; while (utf8JsonReader.Read()) { @@ -151,13 +150,13 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "firstName": - firstName = new Option(utf8JsonReader.GetString()!); + firstName = utf8JsonReader.GetString(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()!); + lastName = utf8JsonReader.GetString(); break; case "$_type": - type = new Option(utf8JsonReader.GetString()!); + type = utf8JsonReader.GetString(); break; default: break; @@ -165,20 +164,16 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Person."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class Person."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Person."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class Person."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Person."); - Option firstNameParsedValue = new Option(firstName.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option typeParsedValue = new Option(type.Value); - - return new Person(firstNameParsedValue, lastNameParsedValue, typeParsedValue); + return new Person(firstName, lastName, type); } /// @@ -205,19 +200,9 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { - if (person.FirstName.Value == null) - throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); - - if (person.LastName.Value == null) - throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); - - if (person.Type.Value == null) - throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person."); - - if (person.FirstName.IsSet) - writer.WriteString("firstName", person.FirstName.Value); if (person.LastName.IsSet) - writer.WriteString("lastName", person.LastName.Value); if (person.Type.IsSet) - writer.WriteString("$_type", person.Type.Value); + writer.WriteString("firstName", person.FirstName); + writer.WriteString("lastName", person.LastName); + writer.WriteString("$_type", person.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs index 42ecb4255353..3c370b043a54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,17 +37,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index c7db177bf146..376581340835 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(Option kind = default) + public Apple(string kind) { Kind = kind; OnCreated(); @@ -48,7 +47,7 @@ public Apple(Option kind = default) /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public Option Kind { get; set; } + public string Kind { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option kind = default; + string? kind = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = new Option(utf8JsonReader.GetString()!); + kind = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind.Value == null) - throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); + if (kind == null) + throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); - Option kindParsedValue = new Option(kind.Value); - - return new Apple(kindParsedValue); + return new Apple(kind); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.Kind.Value == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); - - if (apple.Kind.IsSet) - writer.WriteString("kind", apple.Kind.Value); + writer.WriteString("kind", apple.Kind); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs index 8ad280cacb4c..003d499475e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(Option count = default) + public Banana(decimal count) { Count = count; OnCreated(); @@ -48,7 +47,7 @@ public Banana(Option count = default) /// Gets or Sets Count /// [JsonPropertyName("count")] - public Option Count { get; set; } + public decimal Count { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option count = default; + decimal? count = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = utf8JsonReader.GetDecimal(); break; default: break; @@ -130,12 +129,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count.Value == null) - throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); + if (count == null) + throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); - Option countParsedValue = new Option(count.Value.Value); - - return new Banana(countParsedValue); + return new Banana(count.Value); } /// @@ -162,8 +159,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.Count.IsSet) - writer.WriteNumber("count", banana.Count.Value); + writer.WriteNumber("count", banana.Count); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index cd5112a8166f..7cd885961b7b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Option apple, Option banana, Option color = default) + public Fruit(Apple? apple, Banana? banana, string color) { Apple = apple; Banana = banana; @@ -50,18 +49,18 @@ public Fruit(Option apple, Option banana, Option color /// /// Gets or Sets Apple /// - public Option Apple { get; set; } + public Apple? Apple { get; set; } /// /// Gets or Sets Banana /// - public Option Banana { get; set; } + public Banana? Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -116,7 +115,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -156,7 +155,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -164,15 +163,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); - Option colorParsedValue = new Option(color.Value); - - Option appleParsedValue = new Option(apple); - Option bananaParsedValue = new Option(banana); - - return new Fruit(appleParsedValue, bananaParsedValue, colorParsedValue); + return new Fruit(apple, banana, color); } /// @@ -186,16 +180,16 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt { writer.WriteStartObject(); - if (fruit.Apple.IsSet && fruit.Apple.Value != null) + if (fruit.Apple != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Apple.Value.GetType())); - AppleJsonConverter.WriteProperties(ref writer, fruit.Apple.Value, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Apple.GetType())); + AppleJsonConverter.WriteProperties(ref writer, fruit.Apple, jsonSerializerOptions); } - if (fruit.Banana.IsSet && fruit.Banana.Value != null) + if (fruit.Banana != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Banana.Value.GetType())); - BananaJsonConverter.WriteProperties(ref writer, fruit.Banana.Value, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Banana.GetType())); + BananaJsonConverter.WriteProperties(ref writer, fruit.Banana, jsonSerializerOptions); } WriteProperties(ref writer, fruit, jsonSerializerOptions); @@ -211,11 +205,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs index 42ecb4255353..3c370b043a54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,17 +37,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index c7db177bf146..376581340835 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(Option kind = default) + public Apple(string kind) { Kind = kind; OnCreated(); @@ -48,7 +47,7 @@ public Apple(Option kind = default) /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public Option Kind { get; set; } + public string Kind { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option kind = default; + string? kind = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = new Option(utf8JsonReader.GetString()!); + kind = utf8JsonReader.GetString(); break; default: break; @@ -129,12 +128,10 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind.Value == null) - throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); + if (kind == null) + throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); - Option kindParsedValue = new Option(kind.Value); - - return new Apple(kindParsedValue); + return new Apple(kind); } /// @@ -161,11 +158,7 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.Kind.Value == null) - throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); - - if (apple.Kind.IsSet) - writer.WriteString("kind", apple.Kind.Value); + writer.WriteString("kind", apple.Kind); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs index 8ad280cacb4c..003d499475e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(Option count = default) + public Banana(decimal count) { Count = count; OnCreated(); @@ -48,7 +47,7 @@ public Banana(Option count = default) /// Gets or Sets Count /// [JsonPropertyName("count")] - public Option Count { get; set; } + public decimal Count { get; set; } /// /// Gets or Sets additional properties @@ -103,7 +102,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option count = default; + decimal? count = default; while (utf8JsonReader.Read()) { @@ -122,7 +121,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = new Option(utf8JsonReader.GetDecimal()); + count = utf8JsonReader.GetDecimal(); break; default: break; @@ -130,12 +129,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count.Value == null) - throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); + if (count == null) + throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); - Option countParsedValue = new Option(count.Value.Value); - - return new Banana(countParsedValue); + return new Banana(count.Value); } /// @@ -162,8 +159,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.Count.IsSet) - writer.WriteNumber("count", banana.Count.Value); + writer.WriteNumber("count", banana.Count); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index b1b0e8742ac8..4310e800fe99 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,7 +22,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color = default) + public Fruit(Apple apple, string color) { Apple = apple; Color = color; @@ -48,7 +47,7 @@ public Fruit(Apple apple, Option color = default) /// /// /// color - public Fruit(Banana banana, Option color = default) + public Fruit(Banana banana, string color) { Banana = banana; Color = color; @@ -71,7 +70,7 @@ public Fruit(Banana banana, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -126,7 +125,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string? color = default; Apple? apple = default; Banana? banana = default; @@ -166,7 +165,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()!); + color = utf8JsonReader.GetString(); break; default: break; @@ -174,16 +173,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - - Option colorParsedValue = new Option(color.Value); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); if (apple != null) - return new Fruit(apple, colorParsedValue); + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, colorParsedValue); + return new Fruit(banana, color); throw new JsonException(); } @@ -212,11 +209,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index 05049077c2ac..1179de6767be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -79,7 +79,6 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md -docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -207,7 +206,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md index 470701a32abc..53bbfe31e77c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md index ab628ed7bc0b..28f1a8093581 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md @@ -4,11 +4,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | -**Number** | **decimal** | | -**Password** | **string** | | -**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -16,6 +14,8 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] +**Number** | **decimal** | | +**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md index 4f019b613bd7..b13bb576b450 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | -**PhotoUrls** | **List<string>** | | **Category** | [**Category**](Category.md) | | [optional] **Id** | **long** | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md deleted file mode 100644 index 5ff4cb1b73cc..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNotNullableDateProp** | **DateTime** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNotnullableEnumInteger** | **int** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**RequiredNotnullableEnumString** | **string** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableStringProp** | **string** | | -**RequiredNotnullableUuid** | **Guid** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNullableBooleanProp** | **bool** | | -**RequiredNullableDateProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime** | | -**RequiredNullableEnumInteger** | **int** | | -**RequiredNullableEnumIntegerOnly** | **int** | | -**RequiredNullableEnumString** | **string** | | -**RequiredNullableIntegerProp** | **int** | | -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNullableStringProp** | **string** | | -**RequiredNullableUuid** | **Guid** | | -**NotRequiredNullableDateProp** | **DateTime** | | [optional] -**NotRequiredNullableIntegerProp** | **int** | | [optional] -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNullableBooleanProp** | **bool** | | [optional] -**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNullableEnumInteger** | **int** | | [optional] -**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNullableUuid** | **Guid** | | [optional] - -[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index 62a5cdba43b7..6c82be59af88 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -219,16 +219,6 @@ public async Task TestInlineAdditionalPropertiesAsyncTest() await _instance.TestInlineAdditionalPropertiesAsync(requestBody); } - /// - /// Test TestInlineFreeformAdditionalProperties - /// - [Fact (Skip = "not implemented")] - public async Task TestInlineFreeformAdditionalPropertiesAsyncTest() - { - TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest = default; - await _instance.TestInlineFreeformAdditionalPropertiesAsync(testInlineFreeformAdditionalPropertiesRequest); - } - /// /// Test TestJsonFormData /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index b78fc06d07c5..7fe8f333c81a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -54,21 +54,21 @@ public void CategoryInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Id' /// [Fact] - public void NameTest() + public void IdTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Id' + /// Test the property 'Name' /// [Fact] - public void IdTest() + public void NameTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'Name' } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index bfec38903066..e5a97f428662 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -53,15 +53,6 @@ public void EnumTestInstanceTest() //Assert.IsType(instance); } - /// - /// Test the property 'EnumStringRequired' - /// - [Fact] - public void EnumStringRequiredTest() - { - // TODO unit test for the property 'EnumStringRequired' - } - /// /// Test the property 'EnumInteger' /// @@ -98,6 +89,15 @@ public void EnumStringTest() // TODO unit test for the property 'EnumString' } + /// + /// Test the property 'EnumStringRequired' + /// + [Fact] + public void EnumStringRequiredTest() + { + // TODO unit test for the property 'EnumStringRequired' + } + /// /// Test the property 'OuterEnumDefaultValue' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index 164baa8862be..fbffe502af78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -54,48 +54,30 @@ public void FormatTestInstanceTest() } /// - /// Test the property 'VarByte' - /// - [Fact] - public void VarByteTest() - { - // TODO unit test for the property 'VarByte' - } - - /// - /// Test the property 'Date' - /// - [Fact] - public void DateTest() - { - // TODO unit test for the property 'Date' - } - - /// - /// Test the property 'Number' + /// Test the property 'Binary' /// [Fact] - public void NumberTest() + public void BinaryTest() { - // TODO unit test for the property 'Number' + // TODO unit test for the property 'Binary' } /// - /// Test the property 'Password' + /// Test the property 'VarByte' /// [Fact] - public void PasswordTest() + public void VarByteTest() { - // TODO unit test for the property 'Password' + // TODO unit test for the property 'VarByte' } /// - /// Test the property 'Binary' + /// Test the property 'Date' /// [Fact] - public void BinaryTest() + public void DateTest() { - // TODO unit test for the property 'Binary' + // TODO unit test for the property 'Date' } /// @@ -161,6 +143,24 @@ public void IntegerTest() // TODO unit test for the property 'Integer' } + /// + /// Test the property 'Number' + /// + [Fact] + public void NumberTest() + { + // TODO unit test for the property 'Number' + } + + /// + /// Test the property 'Password' + /// + [Fact] + public void PasswordTest() + { + // TODO unit test for the property 'Password' + } + /// /// Test the property 'PatternWithBackslash' /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs index 8485d1213ce6..fff8db45faad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -54,39 +54,39 @@ public void PetInstanceTest() } /// - /// Test the property 'Name' + /// Test the property 'Category' /// [Fact] - public void NameTest() + public void CategoryTest() { - // TODO unit test for the property 'Name' + // TODO unit test for the property 'Category' } /// - /// Test the property 'PhotoUrls' + /// Test the property 'Id' /// [Fact] - public void PhotoUrlsTest() + public void IdTest() { - // TODO unit test for the property 'PhotoUrls' + // TODO unit test for the property 'Id' } /// - /// Test the property 'Category' + /// Test the property 'Name' /// [Fact] - public void CategoryTest() + public void NameTest() { - // TODO unit test for the property 'Category' + // TODO unit test for the property 'Name' } /// - /// Test the property 'Id' + /// Test the property 'PhotoUrls' /// [Fact] - public void IdTest() + public void PhotoUrlsTest() { - // TODO unit test for the property 'Id' + // TODO unit test for the property 'PhotoUrls' } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 6e8958b1b749..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,452 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 7982f6cfc930..485ee4c9a081 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -141,8 +141,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -151,6 +149,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,30 +167,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) - return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) - return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) - return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) - return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) - return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) - return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 903a95cb48ae..964d9c24a144 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,7 +114,6 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); - _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs index 34653363aacf..70f41078bb68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,17 +35,5 @@ public Option(TType value) IsSet = true; Value = value; } - - /// - /// Implicitly converts this option to the contained type - /// - /// - public static implicit operator TType(Option o) => o.Value; - - /// - /// Implicitly constructs a new Option - /// - /// - public static implicit operator Option(TType t) => new Option(t); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 8d49c1b094c4..42747dee35ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Option>> activityOutputs = default) + public Activity(Dictionary> activityOutputs) { ActivityOutputs = activityOutputs; OnCreated(); @@ -46,7 +45,7 @@ public Activity(Option [JsonPropertyName("activity_outputs")] - public Option>> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> activityOutputs = default; + Dictionary> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs.Value == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); + if (activityOutputs == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); - Option>> activityOutputsParsedValue = new Option>>(activityOutputs.Value); - - return new Activity(activityOutputsParsedValue); + return new Activity(activityOutputs); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - if (activity.ActivityOutputs.Value == null) - throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - - if (activity.ActivityOutputs.IsSet) - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 9927e551973e..233d362f51ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) + public ActivityOutputElementRepresentation(string prop1, Object prop2) { Prop1 = prop1; Prop2 = prop2; @@ -48,13 +47,13 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public Option Prop1 { get; set; } + public string Prop1 { get; set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Option Prop2 { get; set; } + public Object Prop2 { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option prop1 = default; - Option prop2 = default; + string prop1 = default; + Object prop2 = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = new Option(utf8JsonReader.GetString()); + prop1 = utf8JsonReader.GetString(); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -141,16 +140,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1.Value == null) - throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop1 == null) + throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); - if (prop2.Value == null) - throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); + if (prop2 == null) + throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); - Option prop1ParsedValue = new Option(prop1.Value); - Option prop2ParsedValue = new Option(prop2.Value); - - return new ActivityOutputElementRepresentation(prop1ParsedValue, prop2ParsedValue); + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -177,16 +173,9 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - if (activityOutputElementRepresentation.Prop1.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop2.Value == null) - throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); - - if (activityOutputElementRepresentation.Prop1.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1.Value); if (activityOutputElementRepresentation.Prop2.IsSet) - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index e4580e3489eb..ed15d711b7a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -41,7 +40,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) { EmptyMap = emptyMap; MapOfMapProperty = mapOfMapProperty; @@ -61,49 +60,49 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Option EmptyMap { get; set; } + public Object EmptyMap { get; set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Option>> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get; set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Option> MapProperty { get; set; } + public Dictionary MapProperty { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Option MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Option MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Option> MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Option> MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get; set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Option Anytype1 { get; set; } + public Object Anytype1 { get; set; } /// /// Gets or Sets additional properties @@ -165,14 +164,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option emptyMap = default; - Option>> mapOfMapProperty = default; - Option> mapProperty = default; - Option mapWithUndeclaredPropertiesAnytype1 = default; - Option mapWithUndeclaredPropertiesAnytype2 = default; - Option> mapWithUndeclaredPropertiesAnytype3 = default; - Option> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; + Object emptyMap = default; + Dictionary> mapOfMapProperty = default; + Dictionary mapProperty = default; + Object mapWithUndeclaredPropertiesAnytype1 = default; + Object mapWithUndeclaredPropertiesAnytype2 = default; + Dictionary mapWithUndeclaredPropertiesAnytype3 = default; + Dictionary mapWithUndeclaredPropertiesString = default; + Object anytype1 = default; while (utf8JsonReader.Read()) { @@ -191,35 +190,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -227,36 +226,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap.Value == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); + if (emptyMap == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); - if (mapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapOfMapProperty == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapProperty.Value == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapProperty == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - Option emptyMapParsedValue = new Option(emptyMap.Value); - Option>> mapOfMapPropertyParsedValue = new Option>>(mapOfMapProperty.Value); - Option> mapPropertyParsedValue = new Option>(mapProperty.Value); - Option mapWithUndeclaredPropertiesAnytype1ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype1.Value); - Option mapWithUndeclaredPropertiesAnytype2ParsedValue = new Option(mapWithUndeclaredPropertiesAnytype2.Value); - Option> mapWithUndeclaredPropertiesAnytype3ParsedValue = new Option>(mapWithUndeclaredPropertiesAnytype3.Value); - Option> mapWithUndeclaredPropertiesStringParsedValue = new Option>(mapWithUndeclaredPropertiesString.Value); - - return new AdditionalPropertiesClass(emptyMapParsedValue, mapOfMapPropertyParsedValue, mapPropertyParsedValue, mapWithUndeclaredPropertiesAnytype1ParsedValue, mapWithUndeclaredPropertiesAnytype2ParsedValue, mapWithUndeclaredPropertiesAnytype3ParsedValue, mapWithUndeclaredPropertiesStringParsedValue, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -283,56 +274,22 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (additionalPropertiesClass.EmptyMap.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapOfMapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapProperty.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.Value == null) - throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - - if (additionalPropertiesClass.EmptyMap.IsSet) - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapProperty.IsSet) - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapProperty.IsSet) - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesString.IsSet) - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1.IsSet) - if (additionalPropertiesClass.Anytype1.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 9d3a5c581ac7..460543ebf0df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, Option color = default) + public Animal(string className, string color = @"red") { ClassName = className; Color = color; @@ -54,7 +53,7 @@ public Animal(string className, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Gets or Sets additional properties @@ -120,8 +119,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option color = default; + string className = default; + string color = default; while (utf8JsonReader.Read()) { @@ -139,10 +138,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -150,19 +149,13 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Animal.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - - string classNameParsedValue = className.Value; - Option colorParsedValue = new Option(color.Value); - - return new Animal(classNameParsedValue, colorParsedValue); + return new Animal(className, color); } /// @@ -189,14 +182,8 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - if (animal.ClassName == null) - throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); - - if (animal.Color.Value == null) - throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - - writer.WriteString("className", animal.ClassName); if (animal.Color.IsSet) - writer.WriteString("color", animal.Color.Value); + writer.WriteString("className", animal.ClassName); + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index a9c88ec75107..5a7be95495cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(Option code = default, Option message = default, Option type = default) + public ApiResponse(int code, string message, string type) { Code = code; Message = message; @@ -50,19 +49,19 @@ public ApiResponse(Option code = default, Option message = default, /// Gets or Sets Code /// [JsonPropertyName("code")] - public Option Code { get; set; } + public int Code { get; set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public Option Message { get; set; } + public string Message { get; set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public string Type { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option code = default; - Option message = default; - Option type = default; + int? code = default; + string message = default; + string type = default; while (utf8JsonReader.Read()) { @@ -140,13 +139,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = new Option(utf8JsonReader.GetInt32()); + code = utf8JsonReader.GetInt32(); break; case "message": - message = new Option(utf8JsonReader.GetString()); + message = utf8JsonReader.GetString(); break; case "type": - type = new Option(utf8JsonReader.GetString()); + type = utf8JsonReader.GetString(); break; default: break; @@ -154,20 +153,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code.Value == null) - throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); + if (code == null) + throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); - if (message.Value == null) - throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); + if (message == null) + throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); - Option codeParsedValue = new Option(code.Value.Value); - Option messageParsedValue = new Option(message.Value); - Option typeParsedValue = new Option(type.Value); - - return new ApiResponse(codeParsedValue, messageParsedValue, typeParsedValue); + return new ApiResponse(code.Value, message, type); } /// @@ -194,16 +189,9 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - if (apiResponse.Message.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); - - if (apiResponse.Type.Value == null) - throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); - - if (apiResponse.Code.IsSet) - writer.WriteNumber("code", apiResponse.Code.Value); if (apiResponse.Message.IsSet) - writer.WriteString("message", apiResponse.Message.Value); if (apiResponse.Type.IsSet) - writer.WriteString("type", apiResponse.Type.Value); + writer.WriteNumber("code", apiResponse.Code); + writer.WriteString("message", apiResponse.Message); + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index fde2a2e345fd..31246df0422a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) + public Apple(string colorCode, string cultivar, string origin) { ColorCode = colorCode; Cultivar = cultivar; @@ -50,19 +49,19 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public Option ColorCode { get; set; } + public string ColorCode { get; set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public Option Cultivar { get; set; } + public string Cultivar { get; set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public Option Origin { get; set; } + public string Origin { get; set; } /// /// Gets or Sets additional properties @@ -93,28 +92,28 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode.Value != null) { + if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode.Value).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar.Value != null) { + if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar.Value).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin.Value != null) { + if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin.Value).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -146,9 +145,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option colorCode = default; - Option cultivar = default; - Option origin = default; + string colorCode = default; + string cultivar = default; + string origin = default; while (utf8JsonReader.Read()) { @@ -166,13 +165,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = new Option(utf8JsonReader.GetString()); + colorCode = utf8JsonReader.GetString(); break; case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()); + cultivar = utf8JsonReader.GetString(); break; case "origin": - origin = new Option(utf8JsonReader.GetString()); + origin = utf8JsonReader.GetString(); break; default: break; @@ -180,20 +179,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode.Value == null) - throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); + if (colorCode == null) + throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); - if (origin.Value == null) - throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); + if (origin == null) + throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); - Option colorCodeParsedValue = new Option(colorCode.Value); - Option cultivarParsedValue = new Option(cultivar.Value); - Option originParsedValue = new Option(origin.Value); - - return new Apple(colorCodeParsedValue, cultivarParsedValue, originParsedValue); + return new Apple(colorCode, cultivar, origin); } /// @@ -220,19 +215,9 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - if (apple.ColorCode.Value == null) - throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); - - if (apple.Cultivar.Value == null) - throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); - - if (apple.Origin.Value == null) - throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); - - if (apple.ColorCode.IsSet) - writer.WriteString("color_code", apple.ColorCode.Value); if (apple.Cultivar.IsSet) - writer.WriteString("cultivar", apple.Cultivar.Value); if (apple.Origin.IsSet) - writer.WriteString("origin", apple.Origin.Value); + writer.WriteString("color_code", apple.ColorCode); + writer.WriteString("cultivar", apple.Cultivar); + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index 18fc7f3f3216..e0882d925c5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, Option mealy = default) + public AppleReq(string cultivar, bool mealy) { Cultivar = cultivar; Mealy = mealy; @@ -54,7 +53,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public Option Mealy { get; set; } + public bool Mealy { get; set; } /// /// Returns the string presentation of the object @@ -103,8 +102,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option cultivar = default; - Option mealy = default; + string cultivar = default; + bool? mealy = default; while (utf8JsonReader.Read()) { @@ -122,11 +121,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = new Option(utf8JsonReader.GetString()); + cultivar = utf8JsonReader.GetString(); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = new Option(utf8JsonReader.GetBoolean()); + mealy = utf8JsonReader.GetBoolean(); break; default: break; @@ -134,19 +133,13 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!cultivar.IsSet) - throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); + if (cultivar == null) + throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); - if (cultivar.Value == null) - throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); + if (mealy == null) + throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); - if (mealy.Value == null) - throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - - string cultivarParsedValue = cultivar.Value; - Option mealyParsedValue = new Option(mealy.Value.Value); - - return new AppleReq(cultivarParsedValue, mealyParsedValue); + return new AppleReq(cultivar, mealy.Value); } /// @@ -173,11 +166,8 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - if (appleReq.Cultivar == null) - throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - - writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.Mealy.IsSet) - writer.WriteBoolean("mealy", appleReq.Mealy.Value); + writer.WriteString("cultivar", appleReq.Cultivar); + writer.WriteBoolean("mealy", appleReq.Mealy); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 2e8732df9d7b..6fc0afdbc300 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) + public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) { ArrayArrayNumber = arrayArrayNumber; OnCreated(); @@ -46,7 +45,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public Option>> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayNumber = default; + List> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - Option>> arrayArrayNumberParsedValue = new Option>>(arrayArrayNumber.Value); - - return new ArrayOfArrayOfNumberOnly(arrayArrayNumberParsedValue); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - - if (arrayOfArrayOfNumberOnly.ArrayArrayNumber.IsSet) - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index d05e04d3f1d3..0715a3fdf65f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(Option> arrayNumber = default) + public ArrayOfNumberOnly(List arrayNumber) { ArrayNumber = arrayNumber; OnCreated(); @@ -46,7 +45,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public Option> ArrayNumber { get; set; } + public List ArrayNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayNumber = default; + List arrayNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); + if (arrayNumber == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); - Option> arrayNumberParsedValue = new Option>(arrayNumber.Value); - - return new ArrayOfNumberOnly(arrayNumberParsedValue); + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (arrayOfNumberOnly.ArrayNumber.Value == null) - throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - - if (arrayOfNumberOnly.ArrayNumber.IsSet) - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 3c3b95bfaeb7..43088ca1d97b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) + public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) { ArrayArrayOfInteger = arrayArrayOfInteger; ArrayArrayOfModel = arrayArrayOfModel; @@ -50,19 +49,19 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public Option>> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get; set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public Option>> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get; set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public Option> ArrayOfString { get; set; } + public List ArrayOfString { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> arrayArrayOfInteger = default; - Option>> arrayArrayOfModel = default; - Option> arrayOfString = default; + List> arrayArrayOfInteger = default; + List> arrayArrayOfModel = default; + List arrayOfString = default; while (utf8JsonReader.Read()) { @@ -140,15 +139,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -156,20 +155,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); - if (arrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); + if (arrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); - if (arrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); + if (arrayOfString == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); - Option>> arrayArrayOfIntegerParsedValue = new Option>>(arrayArrayOfInteger.Value); - Option>> arrayArrayOfModelParsedValue = new Option>>(arrayArrayOfModel.Value); - Option> arrayOfStringParsedValue = new Option>(arrayOfString.Value); - - return new ArrayTest(arrayArrayOfIntegerParsedValue, arrayArrayOfModelParsedValue, arrayOfStringParsedValue); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -196,24 +191,12 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - if (arrayTest.ArrayArrayOfInteger.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfModel.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayOfString.Value == null) - throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - - if (arrayTest.ArrayArrayOfInteger.IsSet) - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModel.IsSet) - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfString.IsSet) - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs index 04833c9c802b..75bab7a8d056 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(Option lengthCm = default) + public Banana(decimal lengthCm) { LengthCm = lengthCm; OnCreated(); @@ -46,7 +45,7 @@ public Banana(Option lengthCm = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public Option LengthCm { get; set; } + public decimal LengthCm { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; + decimal? lengthCm = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; default: break; @@ -128,12 +127,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); - Option lengthCmParsedValue = new Option(lengthCm.Value.Value); - - return new Banana(lengthCmParsedValue); + return new Banana(lengthCm.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - if (banana.LengthCm.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCm.Value); + writer.WriteNumber("lengthCm", banana.LengthCm); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index 33deb0eeffd9..61e5cf312cca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, Option sweet = default) + public BananaReq(decimal lengthCm, bool sweet) { LengthCm = lengthCm; Sweet = sweet; @@ -54,7 +53,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public Option Sweet { get; set; } + public bool Sweet { get; set; } /// /// Returns the string presentation of the object @@ -103,8 +102,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option lengthCm = default; - Option sweet = default; + decimal? lengthCm = default; + bool? sweet = default; while (utf8JsonReader.Read()) { @@ -123,11 +122,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = new Option(utf8JsonReader.GetDecimal()); + lengthCm = utf8JsonReader.GetDecimal(); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = new Option(utf8JsonReader.GetBoolean()); + sweet = utf8JsonReader.GetBoolean(); break; default: break; @@ -135,19 +134,13 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!lengthCm.IsSet) - throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); + if (lengthCm == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); - if (lengthCm.Value == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); + if (sweet == null) + throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); - if (sweet.Value == null) - throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - - decimal lengthCmParsedValue = lengthCm.Value.Value; - Option sweetParsedValue = new Option(sweet.Value.Value); - - return new BananaReq(lengthCmParsedValue, sweetParsedValue); + return new BananaReq(lengthCm.Value, sweet.Value); } /// @@ -174,8 +167,8 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.Sweet.IsSet) - writer.WriteBoolean("sweet", bananaReq.Sweet.Value); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); + writer.WriteBoolean("sweet", bananaReq.Sweet); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs index 6bba0c922377..c9e4a8bc7120 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - - string classNameParsedValue = className.Value; - - return new BasquePig(classNameParsedValue); + return new BasquePig(className); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - if (basquePig.ClassName == null) - throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index b7384c4a5b19..ca7eb413c65b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) + public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) { ATT_NAME = aTTNAME; CapitalCamel = capitalCamel; @@ -57,37 +56,37 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public Option ATT_NAME { get; set; } + public string ATT_NAME { get; set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public Option CapitalCamel { get; set; } + public string CapitalCamel { get; set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public Option CapitalSnake { get; set; } + public string CapitalSnake { get; set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public Option SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get; set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public Option SmallCamel { get; set; } + public string SmallCamel { get; set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public Option SmallSnake { get; set; } + public string SmallSnake { get; set; } /// /// Gets or Sets additional properties @@ -147,12 +146,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option aTTNAME = default; - Option capitalCamel = default; - Option capitalSnake = default; - Option sCAETHFlowPoints = default; - Option smallCamel = default; - Option smallSnake = default; + string aTTNAME = default; + string capitalCamel = default; + string capitalSnake = default; + string sCAETHFlowPoints = default; + string smallCamel = default; + string smallSnake = default; while (utf8JsonReader.Read()) { @@ -170,22 +169,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = new Option(utf8JsonReader.GetString()); + aTTNAME = utf8JsonReader.GetString(); break; case "CapitalCamel": - capitalCamel = new Option(utf8JsonReader.GetString()); + capitalCamel = utf8JsonReader.GetString(); break; case "Capital_Snake": - capitalSnake = new Option(utf8JsonReader.GetString()); + capitalSnake = utf8JsonReader.GetString(); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); + sCAETHFlowPoints = utf8JsonReader.GetString(); break; case "smallCamel": - smallCamel = new Option(utf8JsonReader.GetString()); + smallCamel = utf8JsonReader.GetString(); break; case "small_Snake": - smallSnake = new Option(utf8JsonReader.GetString()); + smallSnake = utf8JsonReader.GetString(); break; default: break; @@ -193,32 +192,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME.Value == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); + if (aTTNAME == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); - if (capitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); + if (capitalCamel == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); - if (capitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); + if (capitalSnake == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); - if (sCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); + if (sCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); - if (smallCamel.Value == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); + if (smallCamel == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); - if (smallSnake.Value == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); + if (smallSnake == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); - Option aTTNAMEParsedValue = new Option(aTTNAME.Value); - Option capitalCamelParsedValue = new Option(capitalCamel.Value); - Option capitalSnakeParsedValue = new Option(capitalSnake.Value); - Option sCAETHFlowPointsParsedValue = new Option(sCAETHFlowPoints.Value); - Option smallCamelParsedValue = new Option(smallCamel.Value); - Option smallSnakeParsedValue = new Option(smallSnake.Value); - - return new Capitalization(aTTNAMEParsedValue, capitalCamelParsedValue, capitalSnakeParsedValue, sCAETHFlowPointsParsedValue, smallCamelParsedValue, smallSnakeParsedValue); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -245,31 +237,12 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - if (capitalization.ATT_NAME.Value == null) - throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); - - if (capitalization.CapitalCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); - - if (capitalization.CapitalSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); - - if (capitalization.SCAETHFlowPoints.Value == null) - throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); - - if (capitalization.SmallCamel.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); - - if (capitalization.SmallSnake.Value == null) - throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); - - if (capitalization.ATT_NAME.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME.Value); if (capitalization.CapitalCamel.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel.Value); if (capitalization.CapitalSnake.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake.Value); if (capitalization.SCAETHFlowPoints.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints.Value); if (capitalization.SmallCamel.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel.Value); if (capitalization.SmallSnake.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake.Value); + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); + writer.WriteString("smallCamel", capitalization.SmallCamel); + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index b5818597320e..619fc52ce11c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, bool declawed, string color = @"red") : base(className, color) { Declawed = declawed; OnCreated(); @@ -48,7 +47,7 @@ public Cat(string className, Option declawed = default, Option col /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public Option Declawed { get; set; } + public bool Declawed { get; set; } /// /// Returns the string presentation of the object @@ -87,9 +86,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option declawed = default; - Option color = default; + string className = default; + bool? declawed = default; + string color = default; while (utf8JsonReader.Read()) { @@ -107,14 +106,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = new Option(utf8JsonReader.GetBoolean()); + declawed = utf8JsonReader.GetBoolean(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -122,23 +121,16 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Cat.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); + if (declawed == null) + throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); - if (declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - - string classNameParsedValue = className.Value; - Option declawedParsedValue = new Option(declawed.Value.Value); - Option colorParsedValue = new Option(color.Value); - - return new Cat(classNameParsedValue, declawedParsedValue, colorParsedValue); + return new Cat(className, declawed.Value, color); } /// @@ -165,15 +157,9 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - if (cat.ClassName == null) - throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); - - if (cat.Color.Value == null) - throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - - writer.WriteString("className", cat.ClassName); if (cat.Declawed.IsSet) - writer.WriteBoolean("declawed", cat.Declawed.Value); if (cat.Color.IsSet) - writer.WriteString("color", cat.Color.Value); + writer.WriteString("className", cat.ClassName); + writer.WriteBoolean("declawed", cat.Declawed); + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 4354c0ae89cd..6139c3048390 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,29 +31,29 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(long id, string name = @"default-name") { - Name = name; Id = id; + Name = name; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Name + /// Gets or Sets Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long Id { get; set; } /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public Option Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -70,8 +69,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -110,8 +109,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option id = default; + long? id = default; + string name = default; while (utf8JsonReader.Read()) { @@ -128,12 +127,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); break; default: break; @@ -141,19 +140,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Category.", nameof(name)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Category."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Category."); - string nameParsedValue = name.Value; - Option idParsedValue = new Option(id.Value.Value); - - return new Category(nameParsedValue, idParsedValue); + return new Category(id.Value, name); } /// @@ -180,11 +173,8 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - if (category.Name == null) - throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - - writer.WriteString("name", category.Name); if (category.Id.IsSet) - writer.WriteNumber("id", category.Id.Value); + writer.WriteNumber("id", category.Id); + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index 36e500ad991f..a32821259868 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) + public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) { Name = name; PetType = petType; @@ -90,6 +89,7 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// public static string PetTypeEnumToJsonValue(PetTypeEnum value) { + if (value == PetTypeEnum.ChildCat) return "ChildCat"; @@ -100,13 +100,13 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum value) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new Option PetType { get; set; } + public new PetTypeEnum PetType { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Returns the string presentation of the object @@ -146,8 +146,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option petType = default; + string name = default; + ChildCat.PetTypeEnum? petType = default; while (utf8JsonReader.Read()) { @@ -165,12 +165,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - if (petTypeRawValue != null) - petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); + petType = petTypeRawValue == null + ? null + : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); break; default: break; @@ -178,16 +179,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); - Option nameParsedValue = new Option(name.Value); - Option petTypeParsedValue = new Option(petType.Value.Value); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); - return new ChildCat(nameParsedValue, petTypeParsedValue); + return new ChildCat(name, petType.Value); } /// @@ -214,11 +212,9 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - if (childCat.Name.Value == null) - throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + writer.WriteString("name", childCat.Name); - if (childCat.Name.IsSet) - writer.WriteString("name", childCat.Name.Value); var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType.Value); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index d0aa150655d9..d1c65d368199 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(Option varClass = default) + public ClassModel(string varClass) { VarClass = varClass; OnCreated(); @@ -46,7 +45,7 @@ public ClassModel(Option varClass = default) /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; + string varClass = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = new Option(utf8JsonReader.GetString()); + varClass = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); - Option varClassParsedValue = new Option(varClass.Value); - - return new ClassModel(varClassParsedValue); + return new ClassModel(varClass); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - if (classModel.VarClass.Value == null) - throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); - - if (classModel.VarClass.IsSet) - writer.WriteString("_class", classModel.VarClass.Value); + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 4565776de706..79579247f7e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new ComplexQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new ComplexQuadrilateral(quadrilateralType, shapeType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (complexQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); - - if (complexQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs index 0c7b565c1bb1..84439210bcfc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - - string classNameParsedValue = className.Value; - - return new DanishPig(classNameParsedValue); + return new DanishPig(className); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - if (danishPig.ClassName == null) - throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 8f25aa4445dd..4420630af349 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(Option dateOnlyProperty = default) + public DateOnlyClass(DateTime dateOnlyProperty) { DateOnlyProperty = dateOnlyProperty; OnCreated(); @@ -47,7 +46,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public Option DateOnlyProperty { get; set; } + public DateTime DateOnlyProperty { get; set; } /// /// Gets or Sets additional properties @@ -107,7 +106,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateOnlyProperty = default; + DateTime? dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -126,7 +125,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -134,12 +133,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty.Value == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); + if (dateOnlyProperty == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); - Option dateOnlyPropertyParsedValue = new Option(dateOnlyProperty.Value.Value); - - return new DateOnlyClass(dateOnlyPropertyParsedValue); + return new DateOnlyClass(dateOnlyProperty.Value); } /// @@ -166,8 +163,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - if (dateOnlyClass.DateOnlyProperty.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.Value.ToString(DateOnlyPropertyFormat)); + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index e8c1b2b516ad..16e3dfe57faa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(Option name = default) + public DeprecatedObject(string name) { Name = name; OnCreated(); @@ -46,7 +45,7 @@ public DeprecatedObject(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string name = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); - Option nameParsedValue = new Option(name.Value); - - return new DeprecatedObject(nameParsedValue); + return new DeprecatedObject(name); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - if (deprecatedObject.Name.Value == null) - throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); - - if (deprecatedObject.Name.IsSet) - writer.WriteString("name", deprecatedObject.Name.Value); + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 5bf025cfe1be..810934b95efe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,11 +31,11 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// className /// breed + /// className /// color (default to "red") [JsonConstructor] - public Dog(string className, Option breed = default, Option color = default) : base(className, color) + public Dog(string breed, string className, string color = @"red") : base(className, color) { Breed = breed; OnCreated(); @@ -48,7 +47,7 @@ public Dog(string className, Option breed = default, Option colo /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public Option Breed { get; set; } + public string Breed { get; set; } /// /// Returns the string presentation of the object @@ -87,9 +86,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option breed = default; - Option color = default; + string breed = default; + string className = default; + string color = default; while (utf8JsonReader.Read()) { @@ -106,14 +105,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "className": - className = new Option(utf8JsonReader.GetString()); - break; case "breed": - breed = new Option(utf8JsonReader.GetString()); + breed = utf8JsonReader.GetString(); + break; + case "className": + className = utf8JsonReader.GetString(); break; case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -121,23 +120,16 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Dog.", nameof(className)); + if (breed == null) + throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); - if (breed.Value == null) - throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - - string classNameParsedValue = className.Value; - Option breedParsedValue = new Option(breed.Value); - Option colorParsedValue = new Option(color.Value); - - return new Dog(classNameParsedValue, breedParsedValue, colorParsedValue); + return new Dog(breed, className, color); } /// @@ -164,18 +156,9 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - if (dog.ClassName == null) - throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); - - if (dog.Breed.Value == null) - throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); - - if (dog.Color.Value == null) - throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - - writer.WriteString("className", dog.ClassName); if (dog.Breed.IsSet) - writer.WriteString("breed", dog.Breed.Value); if (dog.Color.IsSet) - writer.WriteString("color", dog.Color.Value); + writer.WriteString("breed", dog.Breed); + writer.WriteString("className", dog.ClassName); + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index aab2bfe5fa5b..68f7676ff91f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() { MainShape = mainShape; Shapes = shapes; @@ -52,25 +51,25 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Option MainShape { get; set; } + public Shape MainShape { get; set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public Option> Shapes { get; set; } + public List Shapes { get; set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public Option NullableShape { get; set; } + public NullableShape NullableShape { get; set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public Option ShapeOrNull { get; set; } + public ShapeOrNull ShapeOrNull { get; set; } /// /// Gets or Sets additional properties @@ -139,10 +138,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option mainShape = default; - Option> shapes = default; - Option nullableShape = default; - Option shapeOrNull = default; + Shape mainShape = default; + List shapes = default; + NullableShape nullableShape = default; + ShapeOrNull shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -161,19 +160,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -181,16 +180,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape.Value == null) - throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); + if (mainShape == null) + throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); - if (shapes.Value == null) - throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); + if (shapes == null) + throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); - Option mainShapeParsedValue = new Option(mainShape.Value); - Option> shapesParsedValue = new Option>(shapes.Value); - - return new Drawing(mainShapeParsedValue, shapesParsedValue, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -217,34 +213,14 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - if (drawing.MainShape.Value == null) - throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); - - if (drawing.Shapes.Value == null) - throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - - if (drawing.MainShape.IsSet) - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.Shapes.IsSet) - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShape.IsSet) - if (drawing.NullableShape.Value != null) - { - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - } - else - writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNull.IsSet) - if (drawing.ShapeOrNull.Value != null) - { - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); - } - else - writer.WriteNull("shapeOrNull"); + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index e89d8ebabcec..58cf3e310f81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) + public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) { ArrayEnum = arrayEnum; JustSymbol = justSymbol; @@ -101,6 +100,7 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { + if (value == ArrayEnumEnum.Fish) return "fish"; @@ -167,6 +167,7 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) { + if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -180,13 +181,13 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public Option JustSymbol { get; set; } + public JustSymbolEnum JustSymbol { get; set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public Option> ArrayEnum { get; set; } + public List ArrayEnum { get; set; } /// /// Gets or Sets additional properties @@ -242,8 +243,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayEnum = default; - Option justSymbol = default; + List arrayEnum = default; + EnumArrays.JustSymbolEnum? justSymbol = default; while (utf8JsonReader.Read()) { @@ -262,12 +263,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - if (justSymbolRawValue != null) - justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); + justSymbol = justSymbolRawValue == null + ? null + : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); break; default: break; @@ -275,16 +277,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum.Value == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - - if (justSymbol.Value == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); + if (arrayEnum == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); - Option> arrayEnumParsedValue = new Option>(arrayEnum.Value); - Option justSymbolParsedValue = new Option(justSymbol.Value.Value); + if (justSymbol == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); - return new EnumArrays(arrayEnumParsedValue, justSymbolParsedValue); + return new EnumArrays(arrayEnum, justSymbol.Value); } /// @@ -311,13 +310,10 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - if (enumArrays.ArrayEnum.Value == null) - throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - if (enumArrays.ArrayEnum.IsSet) - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol.Value); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs index b1aff0adf0d8..94c2361c8810 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index 1e7c2e182a77..f3310c22a12b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,23 +31,23 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString + /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) { - EnumStringRequired = enumStringRequired; EnumInteger = enumInteger; EnumIntegerOnly = enumIntegerOnly; EnumNumber = enumNumber; EnumString = enumString; + EnumStringRequired = enumStringRequired; OuterEnumDefaultValue = outerEnumDefaultValue; OuterEnumInteger = outerEnumInteger; OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; @@ -58,162 +57,6 @@ public EnumTest(EnumStringRequiredEnum enumStringRequired, Option - /// Defines EnumStringRequired - /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets EnumStringRequired - /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } - /// /// Defines EnumInteger /// @@ -277,7 +120,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public Option EnumInteger { get; set; } + public EnumIntegerEnum EnumInteger { get; set; } /// /// Defines EnumIntegerOnly @@ -342,7 +185,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public Option EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } /// /// Defines EnumNumber @@ -401,6 +244,7 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) { + if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -414,7 +258,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public Option EnumNumber { get; set; } + public EnumNumberEnum EnumNumber { get; set; } /// /// Defines EnumString @@ -539,6 +383,7 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// public static string EnumStringEnumToJsonValue(EnumStringEnum value) { + if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -570,31 +415,188 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public Option EnumString { get; set; } + public EnumStringEnum EnumString { get; set; } + + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public Option OuterEnumDefaultValue { get; set; } + public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public Option OuterEnumInteger { get; set; } + public OuterEnumInteger OuterEnumInteger { get; set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public Option OuterEnumIntegerDefaultValue { get; set; } + public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public Option OuterEnum { get; set; } + public OuterEnum? OuterEnum { get; set; } /// /// Gets or Sets additional properties @@ -610,11 +612,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -657,15 +659,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option enumStringRequired = default; - Option enumInteger = default; - Option enumIntegerOnly = default; - Option enumNumber = default; - Option enumString = default; - Option outerEnumDefaultValue = default; - Option outerEnumInteger = default; - Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; + EnumTest.EnumIntegerEnum? enumInteger = default; + EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; + EnumTest.EnumNumberEnum? enumNumber = default; + EnumTest.EnumStringEnum? enumString = default; + EnumTest.EnumStringRequiredEnum? enumStringRequired = default; + OuterEnumDefaultValue? outerEnumDefaultValue = default; + OuterEnumInteger? outerEnumInteger = default; + OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; + OuterEnum? outerEnum = default; while (utf8JsonReader.Read()) { @@ -682,47 +684,53 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - if (enumStringRequiredRawValue != null) - enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); - break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); + enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); + enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - if (enumStringRawValue != null) - enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); + enumString = enumStringRawValue == null + ? null + : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); + break; + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + enumStringRequired = enumStringRequiredRawValue == null + ? null + : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumDefaultValueRawValue != null) - outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); + outerEnumDefaultValue = outerEnumDefaultValueRawValue == null + ? null + : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerRawValue != null) - outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); + outerEnumInteger = outerEnumIntegerRawValue == null + ? null + : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - if (outerEnumIntegerDefaultValueRawValue != null) - outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); + outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null + ? null + : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + outerEnum = outerEnumRawValue == null + ? null + : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); break; default: break; @@ -730,43 +738,31 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!enumStringRequired.IsSet) - throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - - if (enumStringRequired.Value == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); + if (enumInteger == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); - if (enumInteger.Value == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); + if (enumIntegerOnly == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); - if (enumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); + if (enumNumber == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); - if (enumNumber.Value == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); + if (enumString == null) + throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); - if (enumString.Value == null) - throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); + if (enumStringRequired == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); - if (outerEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); - if (outerEnumInteger.Value == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); + if (outerEnumInteger == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); - if (outerEnumIntegerDefaultValue.Value == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + if (outerEnumIntegerDefaultValue == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); - EnumTest.EnumStringRequiredEnum enumStringRequiredParsedValue = enumStringRequired.Value.Value; - Option enumIntegerParsedValue = new Option(enumInteger.Value.Value); - Option enumIntegerOnlyParsedValue = new Option(enumIntegerOnly.Value.Value); - Option enumNumberParsedValue = new Option(enumNumber.Value.Value); - Option enumStringParsedValue = new Option(enumString.Value.Value); - Option outerEnumDefaultValueParsedValue = new Option(outerEnumDefaultValue.Value.Value); - Option outerEnumIntegerParsedValue = new Option(outerEnumInteger.Value.Value); - Option outerEnumIntegerDefaultValueParsedValue = new Option(outerEnumIntegerDefaultValue.Value.Value); - - return new EnumTest(enumStringRequiredParsedValue, enumIntegerParsedValue, enumIntegerOnlyParsedValue, enumNumberParsedValue, enumStringParsedValue, outerEnumDefaultValueParsedValue, outerEnumIntegerParsedValue, outerEnumIntegerDefaultValueParsedValue, outerEnum); + return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); } /// @@ -793,44 +789,44 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); + + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); + else + writer.WriteNull("enum_string"); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - if (enumTest.EnumInteger.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger.Value)); if (enumTest.EnumIntegerOnly.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly.Value)); if (enumTest.EnumNumber.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber.Value)); var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString.Value); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); - if (enumTest.OuterEnumDefaultValue.IsSet) - { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); + if (outerEnumDefaultValueRawValue != null) writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - } - if (enumTest.OuterEnumInteger.IsSet) - { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - } - if (enumTest.OuterEnumIntegerDefaultValue.IsSet) + else + writer.WriteNull("outerEnumDefaultValue"); + + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + + if (enumTest.OuterEnum == null) + writer.WriteNull("outerEnum"); + else { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); - } - if (enumTest.OuterEnum.IsSet) - if (enumTest.OuterEnum.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value.Value); + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); + if (outerEnumRawValue != null) writer.WriteString("outerEnum", outerEnumRawValue); - } else writer.WriteNull("outerEnum"); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 7af10613ef2f..626748ff2097 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new EquilateralTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new EquilateralTriangle(shapeType, triangleType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (equilateralTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); - - if (equilateralTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - - writer.WriteString("shapeType", equilateralTriangle.ShapeType); writer.WriteString("triangleType", equilateralTriangle.TriangleType); + writer.WriteString("shapeType", equilateralTriangle.ShapeType); + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 9655d5cd5b6d..905e5452f7c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(Option sourceURI = default) + public File(string sourceURI) { SourceURI = sourceURI; OnCreated(); @@ -47,7 +46,7 @@ public File(Option sourceURI = default) /// /// Test capitalization [JsonPropertyName("sourceURI")] - public Option SourceURI { get; set; } + public string SourceURI { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +101,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option sourceURI = default; + string sourceURI = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = new Option(utf8JsonReader.GetString()); + sourceURI = utf8JsonReader.GetString(); break; default: break; @@ -128,12 +127,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI.Value == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); + if (sourceURI == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); - Option sourceURIParsedValue = new Option(sourceURI.Value); - - return new File(sourceURIParsedValue); + return new File(sourceURI); } /// @@ -160,11 +157,7 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - if (file.SourceURI.Value == null) - throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); - - if (file.SourceURI.IsSet) - writer.WriteString("sourceURI", file.SourceURI.Value); + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 97249c594263..722ba3b949f0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(Option file = default, Option> files = default) + public FileSchemaTestClass(File file, List files) { File = file; Files = files; @@ -48,13 +47,13 @@ public FileSchemaTestClass(Option file = default, Option> files /// Gets or Sets File /// [JsonPropertyName("file")] - public Option File { get; set; } + public File File { get; set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public Option> Files { get; set; } + public List Files { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option file = default; - Option> files = default; + File file = default; + List files = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -142,16 +141,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file.Value == null) - throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); + if (file == null) + throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); - if (files.Value == null) - throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); + if (files == null) + throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); - Option fileParsedValue = new Option(file.Value); - Option> filesParsedValue = new Option>(files.Value); - - return new FileSchemaTestClass(fileParsedValue, filesParsedValue); + return new FileSchemaTestClass(file, files); } /// @@ -178,18 +174,10 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - if (fileSchemaTestClass.File.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.Files.Value == null) - throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - - if (fileSchemaTestClass.File.IsSet) - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.Files.IsSet) - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index b4f1a36c4f8c..9cfe3b508fe8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(Option bar = default) + public Foo(string bar = @"bar") { Bar = bar; OnCreated(); @@ -46,7 +45,7 @@ public Foo(Option bar = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; set; } + public string Bar { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; + string bar = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); - Option barParsedValue = new Option(bar.Value); - - return new Foo(barParsedValue); + return new Foo(bar); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - if (foo.Bar.Value == null) - throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); - - if (foo.Bar.IsSet) - writer.WriteString("bar", foo.Bar.Value); + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 4dc68e62b6e4..c8291e8eae5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Option varString = default) + public FooGetDefaultResponse(Foo varString) { VarString = varString; OnCreated(); @@ -46,7 +45,7 @@ public FooGetDefaultResponse(Option varString = default) /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public Foo VarString { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varString = default; + Foo varString = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); - Option varStringParsedValue = new Option(varString.Value); - - return new FooGetDefaultResponse(varStringParsedValue); + return new FooGetDefaultResponse(varString); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - if (fooGetDefaultResponse.VarString.Value == null) - throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - - if (fooGetDefaultResponse.VarString.IsSet) - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index d60727736d3a..30a9b189932a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,11 +31,9 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// binary /// varByte /// date - /// number - /// password - /// binary /// dateTime /// varDecimal /// varDouble @@ -44,6 +41,8 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer + /// number + /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -52,13 +51,11 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) + public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) { + Binary = binary; VarByte = varByte; Date = date; - Number = number; - Password = password; - Binary = binary; DateTime = dateTime; VarDecimal = varDecimal; VarDouble = varDouble; @@ -66,6 +63,8 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password Int32 = int32; Int64 = int64; Integer = integer; + Number = number; + Password = password; PatternWithBackslash = patternWithBackslash; PatternWithDigits = patternWithDigits; PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; @@ -78,6 +77,12 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password partial void OnCreated(); + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get; set; } + /// /// Gets or Sets VarByte /// @@ -91,112 +96,106 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password [JsonPropertyName("date")] public DateTime Date { get; set; } - /// - /// Gets or Sets Number - /// - [JsonPropertyName("number")] - public decimal Number { get; set; } - - /// - /// Gets or Sets Password - /// - [JsonPropertyName("password")] - public string Password { get; set; } - - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public Option Binary { get; set; } - /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public Option VarDecimal { get; set; } + public decimal VarDecimal { get; set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public Option VarDouble { get; set; } + public double VarDouble { get; set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public Option VarFloat { get; set; } + public float VarFloat { get; set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public Option Int32 { get; set; } + public int Int32 { get; set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public Option Int64 { get; set; } + public long Int64 { get; set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public Option Integer { get; set; } + public int Integer { get; set; } + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public Option PatternWithBackslash { get; set; } + public string PatternWithBackslash { get; set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public Option PatternWithDigits { get; set; } + public string PatternWithDigits { get; set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public Option PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get; set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Option VarString { get; set; } + public string VarString { get; set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public Option UnsignedInteger { get; set; } + public uint UnsignedInteger { get; set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public Option UnsignedLong { get; set; } + public ulong UnsignedLong { get; set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets additional properties @@ -212,11 +211,9 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -224,6 +221,8 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -243,122 +242,122 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - // VarDouble (double) maximum - if (this.VarDouble.IsSet && this.VarDouble.Value > (double)123.4) + if (this.VarDouble > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble.IsSet && this.VarDouble.Value < (double)67.8) + if (this.VarDouble < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat.IsSet && this.VarFloat.Value > (float)987.6) + if (this.VarFloat > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat.IsSet && this.VarFloat.Value < (float)54.3) + if (this.VarFloat < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32.IsSet && this.Int32.Value > (int)200) + if (this.Int32 > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32.IsSet && this.Int32.Value < (int)20) + if (this.Int32 < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer.IsSet && this.Integer.Value > (int)100) + if (this.Integer > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer.IsSet && this.Integer.Value < (int)10) + if (this.Integer < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - if (this.PatternWithBackslash.Value != null) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + + if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash.Value).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits.Value != null) { + if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits.Value).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter.Value != null) { + if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter.Value).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString.Value != null) { + if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString.Value).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value > (uint)200) + if (this.UnsignedInteger > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger.IsSet && this.UnsignedInteger.Value < (uint)20) + if (this.UnsignedInteger < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -399,25 +398,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varByte = default; - Option date = default; - Option number = default; - Option password = default; - Option binary = default; - Option dateTime = default; - Option varDecimal = default; - Option varDouble = default; - Option varFloat = default; - Option int32 = default; - Option int64 = default; - Option integer = default; - Option patternWithBackslash = default; - Option patternWithDigits = default; - Option patternWithDigitsAndDelimiter = default; - Option varString = default; - Option unsignedInteger = default; - Option unsignedLong = default; - Option uuid = default; + System.IO.Stream binary = default; + byte[] varByte = default; + DateTime? date = default; + DateTime? dateTime = default; + decimal? varDecimal = default; + double? varDouble = default; + float? varFloat = default; + int? int32 = default; + long? int64 = default; + int? integer = default; + decimal? number = default; + string password = default; + string patternWithBackslash = default; + string patternWithDigits = default; + string patternWithDigitsAndDelimiter = default; + string varString = default; + uint? unsignedInteger = default; + ulong? unsignedLong = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -434,76 +433,76 @@ 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)); - break; - case "date": + case "binary": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "number": + case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = new Option(utf8JsonReader.GetDecimal()); - break; - case "password": - password = new Option(utf8JsonReader.GetString()); + varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; - case "binary": + case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + date = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = new Option(utf8JsonReader.GetDouble()); + varDouble = utf8JsonReader.GetDouble(); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = new Option((float)utf8JsonReader.GetDouble()); + varFloat = (float)utf8JsonReader.GetDouble(); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = new Option(utf8JsonReader.GetInt32()); + int32 = utf8JsonReader.GetInt32(); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = new Option(utf8JsonReader.GetInt64()); + int64 = utf8JsonReader.GetInt64(); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = new Option(utf8JsonReader.GetInt32()); + integer = utf8JsonReader.GetInt32(); + break; + case "number": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + number = utf8JsonReader.GetDecimal(); + break; + case "password": + password = utf8JsonReader.GetString(); break; case "pattern_with_backslash": - patternWithBackslash = new Option(utf8JsonReader.GetString()); + patternWithBackslash = utf8JsonReader.GetString(); break; case "pattern_with_digits": - patternWithDigits = new Option(utf8JsonReader.GetString()); + patternWithDigits = utf8JsonReader.GetString(); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); + patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); break; case "string": - varString = new Option(utf8JsonReader.GetString()); + varString = utf8JsonReader.GetString(); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = new Option(utf8JsonReader.GetUInt32()); + unsignedInteger = utf8JsonReader.GetUInt32(); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = new Option(utf8JsonReader.GetUInt64()); + unsignedLong = utf8JsonReader.GetUInt64(); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -511,96 +510,64 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (!varByte.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - - if (!date.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - - if (!number.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - - if (!password.IsSet) - throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - - if (varByte.Value == null) - throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); + if (binary == null) + throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); - if (date.Value == null) - throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); + if (varByte == null) + throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); - if (number.Value == null) - throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); + if (date == null) + throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); - if (binary.Value == null) - throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); + if (varDecimal == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); + if (varDouble == null) + throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); - if (varDecimal.Value == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); + if (varFloat == null) + throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); - if (varDouble.Value == null) - throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); + if (int32 == null) + throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); - if (varFloat.Value == null) - throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); + if (int64 == null) + throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); - if (int32.Value == null) - throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); + if (integer == null) + throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); - if (int64.Value == null) - throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); + if (number == null) + throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); - if (integer.Value == null) - throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); - if (patternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); + if (patternWithBackslash == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); - if (patternWithDigits.Value == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); + if (patternWithDigits == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); - if (patternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); + if (patternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - if (varString.Value == null) - throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + if (varString == null) + throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); - if (unsignedInteger.Value == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + if (unsignedInteger == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); - if (unsignedLong.Value == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + if (unsignedLong == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); - byte[] varByteParsedValue = varByte.Value; - DateTime dateParsedValue = date.Value.Value; - decimal numberParsedValue = number.Value.Value; - string passwordParsedValue = password.Value; - Option binaryParsedValue = new Option(binary.Value); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option varDecimalParsedValue = new Option(varDecimal.Value.Value); - Option varDoubleParsedValue = new Option(varDouble.Value.Value); - Option varFloatParsedValue = new Option(varFloat.Value.Value); - Option int32ParsedValue = new Option(int32.Value.Value); - Option int64ParsedValue = new Option(int64.Value.Value); - Option integerParsedValue = new Option(integer.Value.Value); - Option patternWithBackslashParsedValue = new Option(patternWithBackslash.Value); - Option patternWithDigitsParsedValue = new Option(patternWithDigits.Value); - Option patternWithDigitsAndDelimiterParsedValue = new Option(patternWithDigitsAndDelimiter.Value); - Option varStringParsedValue = new Option(varString.Value); - Option unsignedIntegerParsedValue = new Option(unsignedInteger.Value.Value); - Option unsignedLongParsedValue = new Option(unsignedLong.Value.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - - return new FormatTest(varByteParsedValue, dateParsedValue, numberParsedValue, passwordParsedValue, binaryParsedValue, dateTimeParsedValue, varDecimalParsedValue, varDoubleParsedValue, varFloatParsedValue, int32ParsedValue, int64ParsedValue, integerParsedValue, patternWithBackslashParsedValue, patternWithDigitsParsedValue, patternWithDigitsAndDelimiterParsedValue, varStringParsedValue, unsignedIntegerParsedValue, unsignedLongParsedValue, uuidParsedValue); + return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); } /// @@ -627,49 +594,28 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - if (formatTest.VarByte == null) - throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); - - if (formatTest.Password == null) - throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); - - if (formatTest.Binary.Value == null) - throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); - - if (formatTest.PatternWithBackslash.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigits.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); - - if (formatTest.PatternWithDigitsAndDelimiter.Value == null) - throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); - - if (formatTest.VarString.Value == null) - throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); - + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); writer.WritePropertyName("byte"); JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); writer.WriteNumber("number", formatTest.Number); writer.WriteString("password", formatTest.Password); if (formatTest.Binary.IsSet) - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); - if (formatTest.DateTime.IsSet) - writer.WriteString("dateTime", formatTest.DateTime.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimal.IsSet) - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - if (formatTest.VarDouble.IsSet) - writer.WriteNumber("double", formatTest.VarDouble.Value); if (formatTest.VarFloat.IsSet) - writer.WriteNumber("float", formatTest.VarFloat.Value); if (formatTest.Int32.IsSet) - writer.WriteNumber("int32", formatTest.Int32.Value); if (formatTest.Int64.IsSet) - writer.WriteNumber("int64", formatTest.Int64.Value); if (formatTest.Integer.IsSet) - writer.WriteNumber("integer", formatTest.Integer.Value); if (formatTest.PatternWithBackslash.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash.Value); if (formatTest.PatternWithDigits.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits.Value); if (formatTest.PatternWithDigitsAndDelimiter.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter.Value); if (formatTest.VarString.IsSet) - writer.WriteString("string", formatTest.VarString.Value); if (formatTest.UnsignedInteger.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger.Value); if (formatTest.UnsignedLong.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong.Value); if (formatTest.Uuid.IsSet) - writer.WriteString("uuid", formatTest.Uuid.Value); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); + writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + writer.WriteNumber("double", formatTest.VarDouble); + writer.WriteNumber("float", formatTest.VarFloat); + writer.WriteNumber("int32", formatTest.Int32); + writer.WriteNumber("int64", formatTest.Int64); + writer.WriteNumber("integer", formatTest.Integer); + writer.WriteNumber("number", formatTest.Number); + writer.WriteString("password", formatTest.Password); + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); + writer.WriteString("string", formatTest.VarString); + writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); + writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); + writer.WriteString("uuid", formatTest.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index 0ecd4f389c9f..2e05ffb958a4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, Option color = default) + public Fruit(Apple apple, string color) { Apple = apple; Color = color; @@ -46,7 +45,7 @@ public Fruit(Apple apple, Option color = default) /// /// /// color - public Fruit(Banana banana, Option color = default) + public Fruit(Banana banana, string color) { Banana = banana; Color = color; @@ -69,7 +68,7 @@ public Fruit(Banana banana, Option color = default) /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -117,7 +116,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string color = default; Apple apple = default; Banana banana = default; @@ -157,7 +156,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -165,16 +164,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - - Option colorParsedValue = new Option(color.Value); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); if (apple != null) - return new Fruit(apple, colorParsedValue); + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, colorParsedValue); + return new Fruit(banana, color); throw new JsonException(); } @@ -203,11 +200,7 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - if (fruit.Color.Value == null) - throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); - - if (fruit.Color.IsSet) - writer.WriteString("color", fruit.Color.Value); + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs index 75652a1b436e..aa26d3600c05 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index e46437a88bc5..3c2d1ecefc94 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Option apple, Option banana, Option color = default) + public GmFruit(Apple apple, Banana banana, string color) { Apple = apple; Banana = banana; @@ -48,18 +47,18 @@ public GmFruit(Option apple, Option banana, Option color /// /// Gets or Sets Apple /// - public Option Apple { get; set; } + public Apple Apple { get; set; } /// /// Gets or Sets Banana /// - public Option Banana { get; set; } + public Banana Banana { get; set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public Option Color { get; set; } + public string Color { get; set; } /// /// Returns the string presentation of the object @@ -107,7 +106,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option color = default; + string color = default; Apple apple = default; Banana banana = default; @@ -147,7 +146,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = new Option(utf8JsonReader.GetString()); + color = utf8JsonReader.GetString(); break; default: break; @@ -155,15 +154,10 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color.Value == null) - throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); + if (color == null) + throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); - Option colorParsedValue = new Option(color.Value); - - Option appleParsedValue = new Option(apple); - Option bananaParsedValue = new Option(banana); - - return new GmFruit(appleParsedValue, bananaParsedValue, colorParsedValue); + return new GmFruit(apple, banana, color); } /// @@ -177,16 +171,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple.IsSet && gmFruit.Apple.Value != null) + if (gmFruit.Apple != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.Value.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple.Value, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); } - if (gmFruit.Banana.IsSet && gmFruit.Banana.Value != null) + if (gmFruit.Banana != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.Value.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana.Value, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -202,11 +196,7 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - if (gmFruit.Color.Value == null) - throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); - - if (gmFruit.Color.IsSet) - writer.WriteString("color", gmFruit.Color.Value); + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7f03cc930b02..7ae4662ed8d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -111,7 +110,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -129,7 +128,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()); + petType = utf8JsonReader.GetString(); break; default: break; @@ -137,15 +136,10 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - - string petTypeParsedValue = petType.Value; - - return new GrandparentAnimal(petTypeParsedValue); + return new GrandparentAnimal(petType); } /// @@ -172,9 +166,6 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - if (grandparentAnimal.PetType == null) - throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 754c25d5eea7..31360d73f754 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(Option bar = default, Option foo = default) + internal HasOnlyReadOnly(string bar, string foo) { Bar = bar; Foo = foo; @@ -48,13 +47,13 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public Option Foo { get; } + public string Foo { get; } /// /// Gets or Sets additional properties @@ -147,8 +146,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option foo = default; + string bar = default; + string foo = default; while (utf8JsonReader.Read()) { @@ -166,10 +165,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; case "foo": - foo = new Option(utf8JsonReader.GetString()); + foo = utf8JsonReader.GetString(); break; default: break; @@ -177,16 +176,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); - if (foo.Value == null) - throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); + if (foo == null) + throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); - Option barParsedValue = new Option(bar.Value); - Option fooParsedValue = new Option(foo.Value); - - return new HasOnlyReadOnly(barParsedValue, fooParsedValue); + return new HasOnlyReadOnly(bar, foo); } /// @@ -213,15 +209,8 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - if (hasOnlyReadOnly.Bar.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Foo.Value == null) - throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); - - if (hasOnlyReadOnly.Bar.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar.Value); if (hasOnlyReadOnly.Foo.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo.Value); + writer.WriteString("bar", hasOnlyReadOnly.Bar); + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 82ddf5d26c2a..8355d97fa097 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(Option nullableMessage = default) + public HealthCheckResult(string nullableMessage = default) { NullableMessage = nullableMessage; OnCreated(); @@ -46,7 +45,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public Option NullableMessage { get; set; } + public string NullableMessage { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option nullableMessage = default; + string nullableMessage = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = new Option(utf8JsonReader.GetString()); + nullableMessage = utf8JsonReader.GetString(); break; default: break; @@ -154,11 +153,7 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - if (healthCheckResult.NullableMessage.IsSet) - if (healthCheckResult.NullableMessage.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage.Value); - else - writer.WriteNull("NullableMessage"); + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index e23d0ddf0c0e..0355613042f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -103,8 +102,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -122,10 +121,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -133,22 +132,13 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new IsoscelesTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new IsoscelesTriangle(shapeType, triangleType); } /// @@ -175,13 +165,8 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (isoscelesTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); - - if (isoscelesTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index aaace3024a91..42b0c9cb2cf1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(Option var123List = default) + public List(string var123List) { Var123List = var123List; OnCreated(); @@ -46,7 +45,7 @@ public List(Option var123List = default) /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public Option Var123List { get; set; } + public string Var123List { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option var123List = default; + string var123List = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = new Option(utf8JsonReader.GetString()); + var123List = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List.Value == null) - throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); + if (var123List == null) + throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); - Option var123ListParsedValue = new Option(var123List.Value); - - return new List(var123ListParsedValue); + return new List(var123List); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - if (list.Var123List.Value == null) - throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); - - if (list.Var123List.IsSet) - writer.WriteString("123-list", list.Var123List.Value); + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index c133271c04c0..0ad8832af885 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) + public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") { EscapedLiteralString = escapedLiteralString; UnescapedLiteralString = unescapedLiteralString; @@ -48,13 +47,13 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public Option EscapedLiteralString { get; set; } + public string EscapedLiteralString { get; set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public Option UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option escapedLiteralString = default; - Option unescapedLiteralString = default; + string escapedLiteralString = default; + string unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = new Option(utf8JsonReader.GetString()); + escapedLiteralString = utf8JsonReader.GetString(); break; case "unescapedLiteralString": - unescapedLiteralString = new Option(utf8JsonReader.GetString()); + unescapedLiteralString = utf8JsonReader.GetString(); break; default: break; @@ -140,16 +139,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (escapedLiteralString == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); - if (unescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); + if (unescapedLiteralString == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); - Option escapedLiteralStringParsedValue = new Option(escapedLiteralString.Value); - Option unescapedLiteralStringParsedValue = new Option(unescapedLiteralString.Value); - - return new LiteralStringClass(escapedLiteralStringParsedValue, unescapedLiteralStringParsedValue); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -176,15 +172,8 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - if (literalStringClass.EscapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.UnescapedLiteralString.Value == null) - throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); - - if (literalStringClass.EscapedLiteralString.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString.Value); if (literalStringClass.UnescapedLiteralString.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString.Value); + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs index 4b47f18e5ac7..92011ad0e1d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -151,7 +150,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; Pig pig = null; Whale whale = null; @@ -208,7 +207,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -216,22 +215,17 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Mammal.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); if (pig != null) - return new Mammal(pig, classNameParsedValue); + return new Mammal(pig, className); if (whale != null) - return new Mammal(whale, classNameParsedValue); + return new Mammal(whale, className); if (zebra != null) - return new Mammal(zebra, classNameParsedValue); + return new Mammal(zebra, className); throw new JsonException(); } @@ -275,9 +269,6 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - if (mammal.ClassName == null) - throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index 6a9e14232f95..a4fdf221e931 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) + public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) { DirectMap = directMap; IndirectMap = indirectMap; @@ -105,6 +104,7 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { + if (value == InnerEnum.UPPER) return "UPPER"; @@ -118,25 +118,25 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Option> DirectMap { get; set; } + public Dictionary DirectMap { get; set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Option> IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Option>> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get; set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Option> MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get; set; } /// /// Gets or Sets additional properties @@ -194,10 +194,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> directMap = default; - Option> indirectMap = default; - Option>> mapMapOfString = default; - Option> mapOfEnumString = default; + Dictionary directMap = default; + Dictionary indirectMap = default; + Dictionary> mapMapOfString = default; + Dictionary mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -216,19 +216,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -236,24 +236,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap.Value == null) - throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - - if (indirectMap.Value == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); + if (directMap == null) + throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); - if (mapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); + if (indirectMap == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); - if (mapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); + if (mapMapOfString == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); - Option> directMapParsedValue = new Option>(directMap.Value); - Option> indirectMapParsedValue = new Option>(indirectMap.Value); - Option>> mapMapOfStringParsedValue = new Option>>(mapMapOfString.Value); - Option> mapOfEnumStringParsedValue = new Option>(mapOfEnumString.Value); + if (mapOfEnumString == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); - return new MapTest(directMapParsedValue, indirectMapParsedValue, mapMapOfStringParsedValue, mapOfEnumStringParsedValue); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -280,30 +275,14 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - if (mapTest.DirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); - - if (mapTest.IndirectMap.Value == null) - throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); - - if (mapTest.MapMapOfString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); - - if (mapTest.MapOfEnumString.Value == null) - throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - - if (mapTest.DirectMap.IsSet) - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMap.IsSet) - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfString.IsSet) - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumString.IsSet) - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index eebbb305b63d..0ed70f02c2db 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) + public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) { DateTime = dateTime; Map = map; @@ -52,25 +51,25 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = d /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public Option DateTime { get; set; } + public DateTime DateTime { get; set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Option> Map { get; set; } + public Dictionary Map { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid Uuid { get; set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Option UuidWithPattern { get; set; } + public Guid UuidWithPattern { get; set; } /// /// Gets or Sets additional properties @@ -104,7 +103,7 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.Value.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -139,10 +138,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option dateTime = default; - Option> map = default; - Option uuid = default; - Option uuidWithPattern = default; + DateTime? dateTime = default; + Dictionary map = default; + Guid? uuid = default; + Guid? uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -161,19 +160,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = new Option(utf8JsonReader.GetGuid()); + uuidWithPattern = utf8JsonReader.GetGuid(); break; default: break; @@ -181,24 +180,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime.Value == null) - throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime == null) + throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map.Value == null) - throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map == null) + throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern.Value == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - Option dateTimeParsedValue = new Option(dateTime.Value.Value); - Option> mapParsedValue = new Option>(map.Value); - Option uuidParsedValue = new Option(uuid.Value.Value); - Option uuidWithPatternParsedValue = new Option(uuidWithPattern.Value.Value); - - return new MixedPropertiesAndAdditionalPropertiesClass(dateTimeParsedValue, mapParsedValue, uuidParsedValue, uuidWithPatternParsedValue); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); } /// @@ -225,16 +219,11 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - if (mixedPropertiesAndAdditionalPropertiesClass.Map.Value == null) - throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); - - if (mixedPropertiesAndAdditionalPropertiesClass.DateTime.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.Map.IsSet) - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - if (mixedPropertiesAndAdditionalPropertiesClass.Uuid.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern.Value); + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 65f28e93b433..7969b9ae04ed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(Option varClass = default, Option name = default) + public Model200Response(string varClass, int name) { VarClass = varClass; Name = name; @@ -48,13 +47,13 @@ public Model200Response(Option varClass = default, Option name = de /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public Option VarClass { get; set; } + public string VarClass { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public int Name { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClass = default; - Option name = default; + string varClass = default; + int? name = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = new Option(utf8JsonReader.GetString()); + varClass = utf8JsonReader.GetString(); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = new Option(utf8JsonReader.GetInt32()); + name = utf8JsonReader.GetInt32(); break; default: break; @@ -141,16 +140,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass.Value == null) - throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); + if (varClass == null) + throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); - Option varClassParsedValue = new Option(varClass.Value); - Option nameParsedValue = new Option(name.Value.Value); - - return new Model200Response(varClassParsedValue, nameParsedValue); + return new Model200Response(varClass, name.Value); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - if (model200Response.VarClass.Value == null) - throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); - - if (model200Response.VarClass.IsSet) - writer.WriteString("class", model200Response.VarClass.Value); if (model200Response.Name.IsSet) - writer.WriteNumber("name", model200Response.Name.Value); + writer.WriteString("class", model200Response.VarClass); + writer.WriteNumber("name", model200Response.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index e8a6cc98c5cc..810a6a01b8e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(Option varClient = default) + public ModelClient(string varClient) { VarClient = varClient; OnCreated(); @@ -46,7 +45,7 @@ public ModelClient(Option varClient = default) /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public Option VarClient { get; set; } + public string VarClient { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varClient = default; + string varClient = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = new Option(utf8JsonReader.GetString()); + varClient = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient.Value == null) - throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); + if (varClient == null) + throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); - Option varClientParsedValue = new Option(varClient.Value); - - return new ModelClient(varClientParsedValue); + return new ModelClient(varClient); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - if (modelClient.VarClient.Value == null) - throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); - - if (modelClient.VarClient.IsSet) - writer.WriteString("client", modelClient.VarClient.Value); + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index fed1dea8b9fe..edcb6b3403c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) + public Name(int varName, string property, int snakeCase, int var123Number) { VarName = varName; Property = property; @@ -58,19 +57,19 @@ public Name(int varName, Option property = default, Option snakeCas /// Gets or Sets Property /// [JsonPropertyName("property")] - public Option Property { get; set; } + public string Property { get; set; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public Option SnakeCase { get; } + public int SnakeCase { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public Option Var123Number { get; } + public int Var123Number { get; } /// /// Gets or Sets additional properties @@ -165,10 +164,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varName = default; - Option property = default; - Option snakeCase = default; - Option var123Number = default; + int? varName = default; + string property = default; + int? snakeCase = default; + int? var123Number = default; while (utf8JsonReader.Read()) { @@ -187,18 +186,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = new Option(utf8JsonReader.GetInt32()); + varName = utf8JsonReader.GetInt32(); break; case "property": - property = new Option(utf8JsonReader.GetString()); + property = utf8JsonReader.GetString(); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = new Option(utf8JsonReader.GetInt32()); + snakeCase = utf8JsonReader.GetInt32(); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = new Option(utf8JsonReader.GetInt32()); + var123Number = utf8JsonReader.GetInt32(); break; default: break; @@ -206,27 +205,19 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!varName.IsSet) - throw new ArgumentException("Property is required for class Name.", nameof(varName)); + if (varName == null) + throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); - if (varName.Value == null) - throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); + if (property == null) + throw new ArgumentNullException(nameof(property), "Property is required for class Name."); - if (property.Value == null) - throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); + if (snakeCase == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); - if (snakeCase.Value == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); + if (var123Number == null) + throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); - if (var123Number.Value == null) - throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - - int varNameParsedValue = varName.Value.Value; - Option propertyParsedValue = new Option(property.Value); - Option snakeCaseParsedValue = new Option(snakeCase.Value.Value); - Option var123NumberParsedValue = new Option(var123Number.Value.Value); - - return new Name(varNameParsedValue, propertyParsedValue, snakeCaseParsedValue, var123NumberParsedValue); + return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); } /// @@ -253,13 +244,10 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - if (name.Property.Value == null) - throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - - writer.WriteNumber("name", name.VarName); if (name.Property.IsSet) - writer.WriteString("property", name.Property.Value); if (name.SnakeCase.IsSet) - writer.WriteNumber("snake_case", name.SnakeCase.Value); if (name.Var123Number.IsSet) - writer.WriteNumber("123Number", name.Var123Number.Value); + writer.WriteNumber("name", name.VarName); + writer.WriteString("property", name.Property); + writer.WriteNumber("snake_case", name.SnakeCase); + writer.WriteNumber("123Number", name.Var123Number); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 867c76a641df..83ab7f40b1e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option>> aObjVariableobject = default; - Option pkiNotificationtestID = default; + List> aObjVariableobject = default; + int? pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); + aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); + pkiNotificationtestID = utf8JsonReader.GetInt32(); break; default: break; @@ -142,22 +141,13 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (!aObjVariableobject.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); + if (aObjVariableobject == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (!pkiNotificationtestID.IsSet) - throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); + if (pkiNotificationtestID == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - if (aObjVariableobject.Value == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - if (pkiNotificationtestID.Value == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - - List> aObjVariableobjectParsedValue = aObjVariableobject.Value; - int pkiNotificationtestIDParsedValue = pkiNotificationtestID.Value.Value; - - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobjectParsedValue, pkiNotificationtestIDParsedValue); + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); } /// @@ -184,9 +174,6 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { - if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) - throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); - writer.WritePropertyName("a_objVariableobject"); JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 12a42a0308fe..5d9de18c4a36 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +44,7 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() { ArrayItemsNullable = arrayItemsNullable; ObjectItemsNullable = objectItemsNullable; @@ -68,73 +67,73 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonPropertyName("array_items_nullable")] - public Option> ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get; set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Option> ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get; set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public Option> ArrayAndItemsNullableProp { get; set; } + public List ArrayAndItemsNullableProp { get; set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public Option> ArrayNullableProp { get; set; } + public List ArrayNullableProp { get; set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public Option BooleanProp { get; set; } + public bool? BooleanProp { get; set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public Option DateProp { get; set; } + public DateTime? DateProp { get; set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public Option DatetimeProp { get; set; } + public DateTime? DatetimeProp { get; set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public Option IntegerProp { get; set; } + public int? IntegerProp { get; set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public Option NumberProp { get; set; } + public decimal? NumberProp { get; set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Option> ObjectAndItemsNullableProp { get; set; } + public Dictionary ObjectAndItemsNullableProp { get; set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Option> ObjectNullableProp { get; set; } + public Dictionary ObjectNullableProp { get; set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public Option StringProp { get; set; } + public string StringProp { get; set; } /// /// Gets or Sets additional properties @@ -221,18 +220,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayItemsNullable = default; - Option> objectItemsNullable = default; - Option> arrayAndItemsNullableProp = default; - Option> arrayNullableProp = default; - Option booleanProp = default; - Option dateProp = default; - Option datetimeProp = default; - Option integerProp = default; - Option numberProp = default; - Option> objectAndItemsNullableProp = default; - Option> objectNullableProp = default; - Option stringProp = default; + List arrayItemsNullable = default; + Dictionary objectItemsNullable = default; + List arrayAndItemsNullableProp = default; + List arrayNullableProp = default; + bool? booleanProp = default; + DateTime? dateProp = default; + DateTime? datetimeProp = default; + int? integerProp = default; + decimal? numberProp = default; + Dictionary objectAndItemsNullableProp = default; + Dictionary objectNullableProp = default; + string stringProp = default; while (utf8JsonReader.Read()) { @@ -251,50 +250,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = new Option(utf8JsonReader.GetBoolean()); + booleanProp = utf8JsonReader.GetBoolean(); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = new Option(utf8JsonReader.GetInt32()); + integerProp = utf8JsonReader.GetInt32(); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = new Option(utf8JsonReader.GetDecimal()); + numberProp = utf8JsonReader.GetDecimal(); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "string_prop": - stringProp = new Option(utf8JsonReader.GetString()); + stringProp = utf8JsonReader.GetString(); break; default: break; @@ -302,16 +301,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); + if (arrayItemsNullable == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); - if (objectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); + if (objectItemsNullable == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); - Option> arrayItemsNullableParsedValue = new Option>(arrayItemsNullable.Value); - Option> objectItemsNullableParsedValue = new Option>(objectItemsNullable.Value); - - return new NullableClass(arrayItemsNullableParsedValue, objectItemsNullableParsedValue, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -338,75 +334,45 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableClass.ArrayItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ObjectItemsNullable.Value == null) - throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - - if (nullableClass.ArrayItemsNullable.IsSet) - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullable.IsSet) - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullableProp.IsSet) - if (nullableClass.ArrayAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullableProp.IsSet) - if (nullableClass.ArrayNullableProp.Value != null) - { - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("array_nullable_prop"); - if (nullableClass.BooleanProp.IsSet) - if (nullableClass.BooleanProp.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value.Value); - else - writer.WriteNull("boolean_prop"); if (nullableClass.DateProp.IsSet) - if (nullableClass.DateProp.Value != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); if (nullableClass.DatetimeProp.IsSet) - if (nullableClass.DatetimeProp.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); if (nullableClass.IntegerProp.IsSet) - if (nullableClass.IntegerProp.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value.Value); - else - writer.WriteNull("integer_prop"); if (nullableClass.NumberProp.IsSet) - if (nullableClass.NumberProp.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value.Value); - else - writer.WriteNull("number_prop"); if (nullableClass.ObjectAndItemsNullableProp.IsSet) - if (nullableClass.ObjectAndItemsNullableProp.Value != null) - { - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullableProp.IsSet) - if (nullableClass.ObjectNullableProp.Value != null) - { - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - } - else - writer.WriteNull("object_nullable_prop"); - if (nullableClass.StringProp.IsSet) - if (nullableClass.StringProp.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp.Value); - else - writer.WriteNull("string_prop"); + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + + if (nullableClass.BooleanProp != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DateProp != null) + writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimeProp != null) + writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerProp != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberProp != null) + writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); + else + writer.WriteNull("number_prop"); + + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + writer.WriteString("string_prop", nullableClass.StringProp); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 6630472d83cb..684109acd50f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Option uuid = default) + public NullableGuidClass(Guid? uuid = default) { Uuid = uuid; OnCreated(); @@ -47,7 +46,7 @@ public NullableGuidClass(Option uuid = default) /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public Guid? Uuid { get; set; } /// /// Gets or Sets additional properties @@ -102,7 +101,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option uuid = default; + Guid? uuid = default; while (utf8JsonReader.Read()) { @@ -121,7 +120,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = new Option(utf8JsonReader.GetGuid()); + uuid = utf8JsonReader.GetGuid(); break; default: break; @@ -156,11 +155,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - if (nullableGuidClass.Uuid.IsSet) - if (nullableGuidClass.Uuid.Value != null) - writer.WriteString("uuid", nullableGuidClass.Uuid.Value.Value); - else - writer.WriteNull("uuid"); + + if (nullableGuidClass.Uuid == null) + writer.WriteNull("uuid"); + else + writer.WriteString("uuid", nullableGuidClass.Uuid.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs index b9a9262817dc..a44c950b81bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeTypeParsedValue); + return new NullableShape(quadrilateral, shapeType); if (triangle != null) - return new NullableShape(triangle, shapeTypeParsedValue); + return new NullableShape(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - if (nullableShape.ShapeType == null) - throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs index c54ed6a54175..3f3cbf4c5059 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(Option justNumber = default) + public NumberOnly(decimal justNumber) { JustNumber = justNumber; OnCreated(); @@ -46,7 +45,7 @@ public NumberOnly(Option justNumber = default) /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public Option JustNumber { get; set; } + public decimal JustNumber { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option justNumber = default; + decimal? justNumber = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = new Option(utf8JsonReader.GetDecimal()); + justNumber = utf8JsonReader.GetDecimal(); break; default: break; @@ -128,12 +127,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber.Value == null) - throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); + if (justNumber == null) + throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); - Option justNumberParsedValue = new Option(justNumber.Value.Value); - - return new NumberOnly(justNumberParsedValue); + return new NumberOnly(justNumber.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - if (numberOnly.JustNumber.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumber.Value); + writer.WriteNumber("JustNumber", numberOnly.JustNumber); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 01afc19a7190..57a1614f29f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,7 +36,7 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) + public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) { Bars = bars; DeprecatedRef = deprecatedRef; @@ -53,27 +52,27 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonPropertyName("bars")] [Obsolete] - public Option> Bars { get; set; } + public List Bars { get; set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public Option DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public Option Id { get; set; } + public decimal Id { get; set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Option Uuid { get; set; } + public string Uuid { get; set; } /// /// Gets or Sets additional properties @@ -131,10 +130,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> bars = default; - Option deprecatedRef = default; - Option id = default; - Option uuid = default; + List bars = default; + DeprecatedObject deprecatedRef = default; + decimal? id = default; + string uuid = default; while (utf8JsonReader.Read()) { @@ -153,18 +152,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetDecimal()); + id = utf8JsonReader.GetDecimal(); break; case "uuid": - uuid = new Option(utf8JsonReader.GetString()); + uuid = utf8JsonReader.GetString(); break; default: break; @@ -172,24 +171,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars.Value == null) - throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (bars == null) + throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); - if (deprecatedRef.Value == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (deprecatedRef == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); - if (uuid.Value == null) - throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); + if (uuid == null) + throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); - Option> barsParsedValue = new Option>(bars.Value); - Option deprecatedRefParsedValue = new Option(deprecatedRef.Value); - Option idParsedValue = new Option(id.Value.Value); - Option uuidParsedValue = new Option(uuid.Value); - - return new ObjectWithDeprecatedFields(barsParsedValue, deprecatedRefParsedValue, idParsedValue, uuidParsedValue); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); } /// @@ -216,24 +210,12 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - if (objectWithDeprecatedFields.Bars.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.DeprecatedRef.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Uuid.Value == null) - throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - - if (objectWithDeprecatedFields.Bars.IsSet) - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRef.IsSet) - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - if (objectWithDeprecatedFields.Id.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.Id.Value); if (objectWithDeprecatedFields.Uuid.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid.Value); + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + writer.WriteNumber("id", objectWithDeprecatedFields.Id); + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs index 660604e3ef17..91dd67631614 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index 68bd7eae6f50..3258ff154478 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,7 +38,7 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) { Id = id; PetId = petId; @@ -121,6 +120,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Placed) return "placed"; @@ -138,38 +138,38 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// Order Status [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public Option PetId { get; set; } + public long PetId { get; set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public Option Quantity { get; set; } + public int Quantity { get; set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public Option ShipDate { get; set; } + public DateTime ShipDate { get; set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public Option Complete { get; set; } + public bool Complete { get; set; } /// /// Gets or Sets additional properties @@ -234,12 +234,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option petId = default; - Option quantity = default; - Option shipDate = default; - Option status = default; - Option complete = default; + long? id = default; + long? petId = default; + int? quantity = default; + DateTime? shipDate = default; + Order.StatusEnum? status = default; + bool? complete = default; while (utf8JsonReader.Read()) { @@ -258,28 +258,29 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = new Option(utf8JsonReader.GetInt64()); + petId = utf8JsonReader.GetInt64(); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = new Option(utf8JsonReader.GetInt32()); + quantity = utf8JsonReader.GetInt32(); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Order.StatusEnumFromStringOrDefault(statusRawValue); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); + complete = utf8JsonReader.GetBoolean(); break; default: break; @@ -287,32 +288,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - - if (petId.Value == null) - throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Order."); - if (quantity.Value == null) - throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); + if (petId == null) + throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); - if (shipDate.Value == null) - throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); + if (quantity == null) + throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); + if (shipDate == null) + throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); - if (complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Order."); - Option idParsedValue = new Option(id.Value.Value); - Option petIdParsedValue = new Option(petId.Value.Value); - Option quantityParsedValue = new Option(quantity.Value.Value); - Option shipDateParsedValue = new Option(shipDate.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option completeParsedValue = new Option(complete.Value.Value); + if (complete == null) + throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); - return new Order(idParsedValue, petIdParsedValue, quantityParsedValue, shipDateParsedValue, statusParsedValue, completeParsedValue); + return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); } /// @@ -339,18 +333,18 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - if (order.Id.IsSet) - writer.WriteNumber("id", order.Id.Value); if (order.PetId.IsSet) - writer.WriteNumber("petId", order.PetId.Value); if (order.Quantity.IsSet) - writer.WriteNumber("quantity", order.Quantity.Value); if (order.ShipDate.IsSet) - writer.WriteString("shipDate", order.ShipDate.Value.ToString(ShipDateFormat)); var statusRawValue = Order.StatusEnumToJsonValue(order.Status.Value); + writer.WriteNumber("id", order.Id); + writer.WriteNumber("petId", order.PetId); + writer.WriteNumber("quantity", order.Quantity); + writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + + var statusRawValue = Order.StatusEnumToJsonValue(order.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (order.Complete.IsSet) - writer.WriteBoolean("complete", order.Complete.Value); + writer.WriteBoolean("complete", order.Complete); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 94decb7debbd..c37883db124b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) + public OuterComposite(bool myBoolean, decimal myNumber, string myString) { MyBoolean = myBoolean; MyNumber = myNumber; @@ -50,19 +49,19 @@ public OuterComposite(Option myBoolean = default, Option myNumber /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public Option MyBoolean { get; set; } + public bool MyBoolean { get; set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public Option MyNumber { get; set; } + public decimal MyNumber { get; set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public Option MyString { get; set; } + public string MyString { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option myBoolean = default; - Option myNumber = default; - Option myString = default; + bool? myBoolean = default; + decimal? myNumber = default; + string myString = default; while (utf8JsonReader.Read()) { @@ -140,14 +139,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = new Option(utf8JsonReader.GetBoolean()); + myBoolean = utf8JsonReader.GetBoolean(); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = new Option(utf8JsonReader.GetDecimal()); + myNumber = utf8JsonReader.GetDecimal(); break; case "my_string": - myString = new Option(utf8JsonReader.GetString()); + myString = utf8JsonReader.GetString(); break; default: break; @@ -155,20 +154,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean.Value == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); + if (myBoolean == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); - if (myNumber.Value == null) - throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); + if (myNumber == null) + throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); - if (myString.Value == null) - throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); + if (myString == null) + throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); - Option myBooleanParsedValue = new Option(myBoolean.Value.Value); - Option myNumberParsedValue = new Option(myNumber.Value.Value); - Option myStringParsedValue = new Option(myString.Value); - - return new OuterComposite(myBooleanParsedValue, myNumberParsedValue, myStringParsedValue); + return new OuterComposite(myBoolean.Value, myNumber.Value, myString); } /// @@ -195,13 +190,9 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - if (outerComposite.MyString.Value == null) - throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); - - if (outerComposite.MyBoolean.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean.Value); if (outerComposite.MyNumber.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumber.Value); if (outerComposite.MyString.IsSet) - writer.WriteString("my_string", outerComposite.MyString.Value); + writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); + writer.WriteNumber("my_number", outerComposite.MyNumber); + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs index 47bb6793c6ac..a4ec335bb386 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 136fb4c54c4e..7c67db5ddca3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 2ed4f18a657e..84ea65297ab0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index c6a470cc64d1..983d194a1998 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index a2e789f2edef..51d8bee407e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs index eed898ba2b31..eb0129c6ce0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -77,7 +76,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option petType = default; + string petType = default; while (utf8JsonReader.Read()) { @@ -95,7 +94,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = new Option(utf8JsonReader.GetString()); + petType = utf8JsonReader.GetString(); break; default: break; @@ -103,15 +102,10 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (!petType.IsSet) - throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); + if (petType == null) + throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); - if (petType.Value == null) - throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - - string petTypeParsedValue = petType.Value; - - return new ParentPet(petTypeParsedValue); + return new ParentPet(petType); } /// @@ -138,9 +132,6 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - if (parentPet.PetType == null) - throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); } } From 7f8d318f246a2c771a073301ebf733a819093c7d Mon Sep 17 00:00:00 2001 From: devhl Date: Tue, 31 Oct 2023 20:38:05 -0400 Subject: [PATCH 11/23] revert sample updates for a merge master --- .../src/Org.OpenAPITools/Model/Pet.cs | 150 +- .../src/Org.OpenAPITools/Model/Pig.cs | 21 +- .../Model/PolymorphicProperty.cs | 1 - .../Org.OpenAPITools/Model/Quadrilateral.cs | 21 +- .../Model/QuadrilateralInterface.cs | 19 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 39 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2202 ----------------- .../src/Org.OpenAPITools/Model/Return.cs | 20 +- .../Model/RolesReportsHash.cs | 39 +- .../Model/RolesReportsHashRole.cs | 23 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 37 +- .../src/Org.OpenAPITools/Model/Shape.cs | 21 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 21 +- .../Model/SimpleQuadrilateral.cs | 37 +- .../Model/SpecialModelName.cs | 36 +- .../src/Org.OpenAPITools/Model/Tag.cs | 36 +- .../Model/TestCollectionEndingWithWordList.cs | 23 +- .../TestCollectionEndingWithWordListObject.cs | 25 +- ...lineFreeformAdditionalPropertiesRequest.cs | 23 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 23 +- .../Model/TriangleInterface.cs | 19 +- .../src/Org.OpenAPITools/Model/User.cs | 195 +- .../src/Org.OpenAPITools/Model/Whale.cs | 49 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 38 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 - .../Model/ZeroBasedEnumClass.cs | 24 +- .../.openapi-generator/FILES | 2 - .../csharp/OpenAPIClient-httpclient/README.md | 1 - .../OpenAPIClient-httpclient/api/openapi.yaml | 258 -- .../docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1043 -------- .../.openapi-generator/FILES | 2 - .../csharp/OpenAPIClient-net47/README.md | 1 - .../OpenAPIClient-net47/api/openapi.yaml | 258 -- .../OpenAPIClient-net47/docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 -------- .../.openapi-generator/FILES | 2 - .../csharp/OpenAPIClient-net48/README.md | 1 - .../OpenAPIClient-net48/api/openapi.yaml | 258 -- .../OpenAPIClient-net48/docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 -------- .../.openapi-generator/FILES | 2 - .../csharp/OpenAPIClient-net5.0/README.md | 1 - .../OpenAPIClient-net5.0/api/openapi.yaml | 258 -- .../docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 -------- .../.openapi-generator/FILES | 2 - .../OpenAPIClient-unityWebRequest/README.md | 1 - .../api/openapi.yaml | 258 -- .../docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 410 --- .../Org.OpenAPITools/Model/RequiredClass.cs | 1224 --------- .../OpenAPIClient/.openapi-generator/FILES | 2 - .../petstore/csharp/OpenAPIClient/README.md | 1 - .../csharp/OpenAPIClient/api/openapi.yaml | 258 -- .../OpenAPIClient/docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 -------- .../.openapi-generator/FILES | 2 - .../csharp/OpenAPIClientCore/README.md | 1 - .../csharp/OpenAPIClientCore/api/openapi.yaml | 258 -- .../OpenAPIClientCore/docs/RequiredClass.md | 53 - .../Model/RequiredClassTests.cs | 453 ---- .../Org.OpenAPITools/Model/RequiredClass.cs | 1027 -------- 69 files changed, 348 insertions(+), 15602 deletions(-) delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md delete mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs delete mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 226f77e03009..225a9c5328c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -32,19 +31,19 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name - /// photoUrls /// category /// id + /// name + /// photoUrls /// pet status in the store /// tags [JsonConstructor] - public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) + public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) { - Name = name; - PhotoUrls = photoUrls; Category = category; Id = id; + Name = name; + PhotoUrls = photoUrls; Status = status; Tags = tags; OnCreated(); @@ -121,6 +120,7 @@ public static StatusEnum StatusEnumFromString(string value) /// public static string StatusEnumToJsonValue(StatusEnum value) { + if (value == StatusEnum.Available) return "available"; @@ -138,7 +138,19 @@ public static string StatusEnumToJsonValue(StatusEnum value) /// /// pet status in the store [JsonPropertyName("status")] - public Option Status { get; set; } + public StatusEnum Status { get; set; } + + /// + /// Gets or Sets Category + /// + [JsonPropertyName("category")] + public Category Category { get; set; } + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long Id { get; set; } /// /// Gets or Sets Name @@ -153,23 +165,11 @@ public static string StatusEnumToJsonValue(StatusEnum value) [JsonPropertyName("photoUrls")] public List PhotoUrls { get; set; } - /// - /// Gets or Sets Category - /// - [JsonPropertyName("category")] - public Option Category { get; set; } - - /// - /// Gets or Sets Id - /// - [JsonPropertyName("id")] - public Option Id { get; set; } - /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public Option> Tags { get; set; } + public List Tags { get; set; } /// /// Gets or Sets additional properties @@ -185,10 +185,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Category: ").Append(Category).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -229,12 +229,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; - Option> photoUrls = default; - Option category = default; - Option id = default; - Option status = default; - Option> tags = default; + Category category = default; + long? id = default; + string name = default; + List photoUrls = default; + Pet.StatusEnum? status = default; + List tags = default; while (utf8JsonReader.Read()) { @@ -251,29 +251,30 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; - case "photoUrls": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); + break; + case "name": + name = utf8JsonReader.GetString(); + break; + case "photoUrls": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - if (statusRawValue != null) - status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); + status = statusRawValue == null + ? null + : Pet.StatusEnumFromStringOrDefault(statusRawValue); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -281,38 +282,25 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!name.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(name)); - - if (!photoUrls.IsSet) - throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); - - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); + if (category == null) + throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); - if (photoUrls.Value == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); - if (category.Value == null) - throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); + if (photoUrls == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); - if (status.Value == null) - throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); + if (status == null) + throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); - if (tags.Value == null) - throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); + if (tags == null) + throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); - string nameParsedValue = name.Value; - List photoUrlsParsedValue = photoUrls.Value; - Option categoryParsedValue = new Option(category.Value); - Option idParsedValue = new Option(id.Value.Value); - Option statusParsedValue = new Option(status.Value.Value); - Option> tagsParsedValue = new Option>(tags.Value); - - return new Pet(nameParsedValue, photoUrlsParsedValue, categoryParsedValue, idParsedValue, statusParsedValue, tagsParsedValue); + return new Pet(category, id.Value, name, photoUrls, status.Value, tags); } /// @@ -339,33 +327,21 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - if (pet.Name == null) - throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); - - if (pet.PhotoUrls == null) - throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); - - if (pet.Category.Value == null) - throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - - if (pet.Tags.Value == null) - throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - - writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + writer.WriteNumber("id", pet.Id); + writer.WriteString("name", pet.Name); + writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); - if (pet.Category.IsSet) - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - if (pet.Id.IsSet) - writer.WriteNumber("id", pet.Id.Value); var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status.Value); + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.Tags.IsSet) - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs index 25983ae01515..8185d643e794 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; + string className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -185,7 +184,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Pig.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); - - string classNameParsedValue = className.Value; + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); if (basquePig != null) - return new Pig(basquePig, classNameParsedValue); + return new Pig(basquePig, className); if (danishPig != null) - return new Pig(danishPig, classNameParsedValue); + return new Pig(danishPig, className); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - if (pig.ClassName == null) - throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 2c2227a22512..3a89a8716e07 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 07e96cf8bb56..65f7b8b4536f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -185,7 +184,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); - - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(complexQuadrilateral, quadrilateralType); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralTypeParsedValue); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 0804077cd4c8..c329eed3266b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; + string quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - - return new QuadrilateralInterface(quadrilateralTypeParsedValue); + return new QuadrilateralInterface(quadrilateralType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - if (quadrilateralInterface.QuadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 5acfdc25b589..2c8b4fff43d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(Option bar = default, Option baz = default) + public ReadOnlyFirst(string bar, string baz) { Bar = bar; Baz = baz; @@ -48,13 +47,13 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public Option Bar { get; } + public string Bar { get; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public Option Baz { get; set; } + public string Baz { get; set; } /// /// Gets or Sets additional properties @@ -146,8 +145,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option bar = default; - Option baz = default; + string bar = default; + string baz = default; while (utf8JsonReader.Read()) { @@ -165,10 +164,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = new Option(utf8JsonReader.GetString()); + bar = utf8JsonReader.GetString(); break; case "baz": - baz = new Option(utf8JsonReader.GetString()); + baz = utf8JsonReader.GetString(); break; default: break; @@ -176,16 +175,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar.Value == null) - throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); + if (bar == null) + throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); - if (baz.Value == null) - throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); + if (baz == null) + throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); - Option barParsedValue = new Option(bar.Value); - Option bazParsedValue = new Option(baz.Value); - - return new ReadOnlyFirst(barParsedValue, bazParsedValue); + return new ReadOnlyFirst(bar, baz); } /// @@ -212,15 +208,8 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - if (readOnlyFirst.Bar.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Baz.Value == null) - throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); - - if (readOnlyFirst.Bar.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar.Value); if (readOnlyFirst.Baz.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz.Value); + writer.WriteString("bar", readOnlyFirst.Bar); + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 6ae20bbe399f..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,2202 +0,0 @@ -// -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Text.Json; -using System.Text.Json.Serialization; -using System.ComponentModel.DataAnnotations; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - public partial class RequiredClass : IValidatableObject - { - /// - /// Initializes a new instance of the class. - /// - /// requiredNotNullableDateProp - /// requiredNotnullableArrayOfString - /// requiredNotnullableBooleanProp - /// requiredNotnullableDatetimeProp - /// requiredNotnullableEnumInteger - /// requiredNotnullableEnumIntegerOnly - /// requiredNotnullableEnumString - /// requiredNotnullableOuterEnumDefaultValue - /// requiredNotnullableStringProp - /// requiredNotnullableUuid - /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid - /// requiredNullableArrayOfString - /// requiredNullableBooleanProp - /// requiredNullableDateProp - /// requiredNullableDatetimeProp - /// requiredNullableEnumInteger - /// requiredNullableEnumIntegerOnly - /// requiredNullableEnumString - /// requiredNullableIntegerProp - /// requiredNullableOuterEnumDefaultValue - /// requiredNullableStringProp - /// requiredNullableUuid - /// notRequiredNullableDateProp - /// notRequiredNullableIntegerProp - /// notrequiredNullableArrayOfString - /// notrequiredNullableBooleanProp - /// notrequiredNullableDatetimeProp - /// notrequiredNullableEnumInteger - /// notrequiredNullableEnumIntegerOnly - /// notrequiredNullableEnumString - /// notrequiredNullableOuterEnumDefaultValue - /// notrequiredNullableStringProp - /// notrequiredNullableUuid - [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) - { - RequiredNotNullableDateProp = requiredNotNullableDateProp; - RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - RequiredNotnullableEnumString = requiredNotnullableEnumString; - RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - RequiredNotnullableStringProp = requiredNotnullableStringProp; - RequiredNotnullableUuid = requiredNotnullableUuid; - RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - RequiredNullableArrayOfString = requiredNullableArrayOfString; - RequiredNullableBooleanProp = requiredNullableBooleanProp; - RequiredNullableDateProp = requiredNullableDateProp; - RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - RequiredNullableEnumInteger = requiredNullableEnumInteger; - RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - RequiredNullableEnumString = requiredNullableEnumString; - RequiredNullableIntegerProp = requiredNullableIntegerProp; - RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - RequiredNullableStringProp = requiredNullableStringProp; - RequiredNullableUuid = requiredNullableUuid; - NotRequiredNullableDateProp = notRequiredNullableDateProp; - NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - NotrequiredNullableEnumString = notrequiredNullableEnumString; - NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - NotrequiredNullableStringProp = notrequiredNullableStringProp; - NotrequiredNullableUuid = notrequiredNullableUuid; - OnCreated(); - } - - partial void OnCreated(); - - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNotnullableEnumString - /// - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) - { - if (value == RequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public Option NotrequiredNotnullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public Option NotrequiredNotnullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNotnullableEnumString - /// - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum value) - { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNotnullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNotnullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public Option NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public Option NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } - - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines RequiredNullableEnumString - /// - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == RequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == RequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == RequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) - { - if (value.Equals((1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_1; - - if (value.Equals((-1).ToString())) - return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [JsonPropertyName("notrequired_nullable_enum_integer")] - public Option NotrequiredNullableEnumInteger { get; set; } - - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) - { - if (value.Equals((2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; - - if (value.Equals((-2).ToString())) - return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) - { - return (int) value; - } - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public Option NotrequiredNullableEnumIntegerOnly { get; set; } - - /// - /// Defines NotrequiredNullableEnumString - /// - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } - - /// - /// Returns a - /// - /// - /// - /// - public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); - } - - /// - /// Returns a - /// - /// - /// - public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return NotrequiredNullableEnumStringEnum.UPPER; - - if (value.Equals("lower")) - return NotrequiredNullableEnumStringEnum.Lower; - - if (value.Equals("")) - return NotrequiredNullableEnumStringEnum.Empty; - - if (value.Equals("Value\twith tab")) - return NotrequiredNullableEnumStringEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNullableEnumStringEnum.Duplicatevalue2; - - return null; - } - - /// - /// Converts the to the json value - /// - /// - /// - /// - public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) - { - if (value == null) - return null; - - if (value == NotrequiredNullableEnumStringEnum.UPPER) - return "UPPER"; - - if (value == NotrequiredNullableEnumStringEnum.Lower) - return "lower"; - - if (value == NotrequiredNullableEnumStringEnum.Empty) - return ""; - - if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [JsonPropertyName("notrequired_nullable_enum_string")] - public Option NotrequiredNullableEnumString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public Option NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public Option NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public Option NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public Option> NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public Option NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public Option NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public Option NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Option NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [JsonPropertyName("not_required_nullable_date_prop")] - public Option NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public Option NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [JsonPropertyName("notrequired_nullable_array_of_string")] - public Option> NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [JsonPropertyName("notrequired_nullable_boolean_prop")] - public Option NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [JsonPropertyName("notrequired_nullable_datetime_prop")] - public Option NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [JsonPropertyName("notrequired_nullable_string_prop")] - public Option NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_nullable_uuid")] - public Option NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public Dictionary AdditionalProperties { get; } = new Dictionary(); - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - - /// - /// A Json converter for type - /// - public class RequiredClassJsonConverter : JsonConverter - { - /// - /// The format to use to serialize RequiredNotNullableDateProp - /// - public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNotnullableDatetimeProp - /// - public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize RequiredNullableDateProp - /// - public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize RequiredNullableDatetimeProp - /// - public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// The format to use to serialize NotRequiredNullableDateProp - /// - public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNullableDatetimeProp - /// - public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - - /// - /// Deserializes json to - /// - /// - /// - /// - /// - /// - public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) - { - int currentDepth = utf8JsonReader.CurrentDepth; - - if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) - throw new JsonException(); - - JsonTokenType startingTokenType = utf8JsonReader.TokenType; - - Option requiredNotNullableDateProp = default; - Option> requiredNotnullableArrayOfString = default; - Option requiredNotnullableBooleanProp = default; - Option requiredNotnullableDatetimeProp = default; - Option requiredNotnullableEnumInteger = default; - Option requiredNotnullableEnumIntegerOnly = default; - Option requiredNotnullableEnumString = default; - Option requiredNotnullableOuterEnumDefaultValue = default; - Option requiredNotnullableStringProp = default; - Option requiredNotnullableUuid = default; - Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; - Option> requiredNullableArrayOfString = default; - Option requiredNullableBooleanProp = default; - Option requiredNullableDateProp = default; - Option requiredNullableDatetimeProp = default; - Option requiredNullableEnumInteger = default; - Option requiredNullableEnumIntegerOnly = default; - Option requiredNullableEnumString = default; - Option requiredNullableIntegerProp = default; - Option requiredNullableOuterEnumDefaultValue = default; - Option requiredNullableStringProp = default; - Option requiredNullableUuid = default; - Option notRequiredNullableDateProp = default; - Option notRequiredNullableIntegerProp = default; - Option> notrequiredNullableArrayOfString = default; - Option notrequiredNullableBooleanProp = default; - Option notrequiredNullableDatetimeProp = default; - Option notrequiredNullableEnumInteger = default; - Option notrequiredNullableEnumIntegerOnly = default; - Option notrequiredNullableEnumString = default; - Option notrequiredNullableOuterEnumDefaultValue = default; - Option notrequiredNullableStringProp = default; - Option notrequiredNullableUuid = default; - - while (utf8JsonReader.Read()) - { - if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) - break; - - if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) - { - string localVarJsonPropertyName = utf8JsonReader.GetString(); - utf8JsonReader.Read(); - - switch (localVarJsonPropertyName) - { - case "required_not_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "required_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_notnullable_enum_string": - string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableEnumStringRawValue != null) - requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); - break; - case "required_notnullable_outerEnumDefaultValue": - string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNotnullableOuterEnumDefaultValueRawValue != null) - requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "required_notnullable_string_prop": - requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "required_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "required_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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)); - break; - case "required_nullable_enum_integer": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "required_nullable_enum_string": - string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (requiredNullableEnumStringRawValue != null) - requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); - break; - case "required_nullable_integer_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "required_nullable_outerEnumDefaultValue": - string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); - break; - case "required_nullable_string_prop": - requiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "required_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - case "not_required_nullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_nullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_nullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_nullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_nullable_enum_string": - string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableEnumStringRawValue != null) - notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); - break; - case "notrequired_nullable_outerEnumDefaultValue": - string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNullableOuterEnumDefaultValueRawValue != null) - notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_nullable_string_prop": - notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_nullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); - break; - default: - break; - } - } - } - - if (!requiredNotNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); - - if (!requiredNotnullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); - - if (!requiredNotnullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); - - if (!requiredNotnullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); - - if (!requiredNotnullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); - - if (!requiredNotnullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); - - if (!requiredNotnullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); - - if (!requiredNotnullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); - - if (!requiredNotnullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); - - if (!requiredNotnullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); - - if (!requiredNotnullableintegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); - - if (!requiredNullableArrayOfString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); - - if (!requiredNullableBooleanProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); - - if (!requiredNullableDateProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); - - if (!requiredNullableDatetimeProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); - - if (!requiredNullableEnumInteger.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); - - if (!requiredNullableEnumIntegerOnly.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); - - if (!requiredNullableEnumString.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); - - if (!requiredNullableIntegerProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); - - if (!requiredNullableOuterEnumDefaultValue.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); - - if (!requiredNullableStringProp.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); - - if (!requiredNullableUuid.IsSet) - throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); - - if (requiredNotNullableDateProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - if (requiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableDateProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); - - if (notRequiredNotnullableintegerProp.Value == null) - throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableBooleanProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableDatetimeProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumInteger.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumIntegerOnly.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableEnumString.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableOuterEnumDefaultValue.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); - - if (notrequiredNotnullableUuid.Value == null) - throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - - DateTime requiredNotNullableDatePropParsedValue = requiredNotNullableDateProp.Value.Value; - List requiredNotnullableArrayOfStringParsedValue = requiredNotnullableArrayOfString.Value; - bool requiredNotnullableBooleanPropParsedValue = requiredNotnullableBooleanProp.Value.Value; - DateTime requiredNotnullableDatetimePropParsedValue = requiredNotnullableDatetimeProp.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumIntegerParsedValue = requiredNotnullableEnumInteger.Value.Value; - RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnlyParsedValue = requiredNotnullableEnumIntegerOnly.Value.Value; - RequiredClass.RequiredNotnullableEnumStringEnum requiredNotnullableEnumStringParsedValue = requiredNotnullableEnumString.Value.Value; - OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValueParsedValue = requiredNotnullableOuterEnumDefaultValue.Value.Value; - string requiredNotnullableStringPropParsedValue = requiredNotnullableStringProp.Value; - Guid requiredNotnullableUuidParsedValue = requiredNotnullableUuid.Value.Value; - int requiredNotnullableintegerPropParsedValue = requiredNotnullableintegerProp.Value.Value; - Option notRequiredNotnullableDatePropParsedValue = new Option(notRequiredNotnullableDateProp.Value.Value); - Option notRequiredNotnullableintegerPropParsedValue = new Option(notRequiredNotnullableintegerProp.Value.Value); - Option> notrequiredNotnullableArrayOfStringParsedValue = new Option>(notrequiredNotnullableArrayOfString.Value); - Option notrequiredNotnullableBooleanPropParsedValue = new Option(notrequiredNotnullableBooleanProp.Value.Value); - Option notrequiredNotnullableDatetimePropParsedValue = new Option(notrequiredNotnullableDatetimeProp.Value.Value); - Option notrequiredNotnullableEnumIntegerParsedValue = new Option(notrequiredNotnullableEnumInteger.Value.Value); - Option notrequiredNotnullableEnumIntegerOnlyParsedValue = new Option(notrequiredNotnullableEnumIntegerOnly.Value.Value); - Option notrequiredNotnullableEnumStringParsedValue = new Option(notrequiredNotnullableEnumString.Value.Value); - Option notrequiredNotnullableOuterEnumDefaultValueParsedValue = new Option(notrequiredNotnullableOuterEnumDefaultValue.Value.Value); - Option notrequiredNotnullableStringPropParsedValue = new Option(notrequiredNotnullableStringProp.Value); - Option notrequiredNotnullableUuidParsedValue = new Option(notrequiredNotnullableUuid.Value.Value); - List requiredNullableArrayOfStringParsedValue = requiredNullableArrayOfString.Value; - bool? requiredNullableBooleanPropParsedValue = requiredNullableBooleanProp.Value; - DateTime? requiredNullableDatePropParsedValue = requiredNullableDateProp.Value; - DateTime? requiredNullableDatetimePropParsedValue = requiredNullableDatetimeProp.Value; - RequiredClass.RequiredNullableEnumIntegerEnum? requiredNullableEnumIntegerParsedValue = requiredNullableEnumInteger.Value; - RequiredClass.RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnlyParsedValue = requiredNullableEnumIntegerOnly.Value; - RequiredClass.RequiredNullableEnumStringEnum? requiredNullableEnumStringParsedValue = requiredNullableEnumString.Value; - int? requiredNullableIntegerPropParsedValue = requiredNullableIntegerProp.Value; - OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValueParsedValue = requiredNullableOuterEnumDefaultValue.Value; - string requiredNullableStringPropParsedValue = requiredNullableStringProp.Value; - Guid? requiredNullableUuidParsedValue = requiredNullableUuid.Value; - - return new RequiredClass(requiredNotNullableDatePropParsedValue, requiredNotnullableArrayOfStringParsedValue, requiredNotnullableBooleanPropParsedValue, requiredNotnullableDatetimePropParsedValue, requiredNotnullableEnumIntegerParsedValue, requiredNotnullableEnumIntegerOnlyParsedValue, requiredNotnullableEnumStringParsedValue, requiredNotnullableOuterEnumDefaultValueParsedValue, requiredNotnullableStringPropParsedValue, requiredNotnullableUuidParsedValue, requiredNotnullableintegerPropParsedValue, notRequiredNotnullableDatePropParsedValue, notRequiredNotnullableintegerPropParsedValue, notrequiredNotnullableArrayOfStringParsedValue, notrequiredNotnullableBooleanPropParsedValue, notrequiredNotnullableDatetimePropParsedValue, notrequiredNotnullableEnumIntegerParsedValue, notrequiredNotnullableEnumIntegerOnlyParsedValue, notrequiredNotnullableEnumStringParsedValue, notrequiredNotnullableOuterEnumDefaultValueParsedValue, notrequiredNotnullableStringPropParsedValue, notrequiredNotnullableUuidParsedValue, requiredNullableArrayOfStringParsedValue, requiredNullableBooleanPropParsedValue, requiredNullableDatePropParsedValue, requiredNullableDatetimePropParsedValue, requiredNullableEnumIntegerParsedValue, requiredNullableEnumIntegerOnlyParsedValue, requiredNullableEnumStringParsedValue, requiredNullableIntegerPropParsedValue, requiredNullableOuterEnumDefaultValueParsedValue, requiredNullableStringPropParsedValue, requiredNullableUuidParsedValue, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); - } - - /// - /// Serializes a - /// - /// - /// - /// - /// - public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - writer.WriteStartObject(); - - WriteProperties(ref writer, requiredClass, jsonSerializerOptions); - writer.WriteEndObject(); - } - - /// - /// Serializes the properties of - /// - /// - /// - /// - /// - public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) - { - if (requiredClass.RequiredNotnullableArrayOfString == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.RequiredNotnullableStringProp == null) - throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableArrayOfString.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); - - if (requiredClass.NotrequiredNotnullableStringProp.Value == null) - throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); - if (requiredNotnullableEnumStringRawValue != null) - writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); - else - writer.WriteNull("required_notnullable_enum_string"); - - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); - writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDateProp.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDateProp.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerProp.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerProp.Value); if (requiredClass.NotrequiredNotnullableArrayOfString.IsSet) - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - if (requiredClass.NotrequiredNotnullableBooleanProp.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanProp.Value); if (requiredClass.NotrequiredNotnullableDatetimeProp.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimeProp.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumInteger.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumInteger.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnly.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnly.Value)); var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumString.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringProp.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp.Value); if (requiredClass.NotrequiredNotnullableUuid.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuid.Value); if (requiredClass.RequiredNullableArrayOfString != null) - { - writer.WritePropertyName("required_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("required_nullable_array_of_string"); - if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); - else - writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); - else - writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); - else - writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); - else - writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); - else - writer.WriteNull("required_nullable_enum_integer_only"); var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString); - if (requiredNullableEnumStringRawValue != null) - writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); - else - writer.WriteNull("required_nullable_enum_string"); - - if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); - else - writer.WriteNull("required_nullable_integer_prop"); if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - else - { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); - if (requiredNullableOuterEnumDefaultValueRawValue != null) - writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); - else - writer.WriteNull("required_nullable_outerEnumDefaultValue"); - } - - if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); - else - writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); - else - writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDateProp.IsSet) - if (requiredClass.NotRequiredNullableDateProp.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDateProp.Value.Value.ToString(NotRequiredNullableDatePropFormat)); - else - writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerProp.IsSet) - if (requiredClass.NotRequiredNullableIntegerProp.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerProp.Value.Value); - else - writer.WriteNull("not_required_nullable_integer_prop"); if (requiredClass.NotrequiredNullableArrayOfString.IsSet) - if (requiredClass.NotrequiredNullableArrayOfString.Value != null) - { - writer.WritePropertyName("notrequired_nullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); - } - else - writer.WriteNull("notrequired_nullable_array_of_string"); - if (requiredClass.NotrequiredNullableBooleanProp.IsSet) - if (requiredClass.NotrequiredNullableBooleanProp.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanProp.Value.Value); - else - writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimeProp.IsSet) - if (requiredClass.NotrequiredNullableDatetimeProp.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimeProp.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); - else - writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumInteger.IsSet) - if (requiredClass.NotrequiredNullableEnumInteger.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumInteger.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnly.IsSet) - if (requiredClass.NotrequiredNullableEnumIntegerOnly.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnly.Value.Value)); - else - writer.WriteNull("notrequired_nullable_enum_integer_only"); var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumString.Value); - if (notrequiredNullableEnumStringRawValue != null) - writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); - else - writer.WriteNull("notrequired_nullable_enum_string"); - - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.IsSet) - if (requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value != null) - { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValue.Value.Value); - writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); - } - else - writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); - if (requiredClass.NotrequiredNullableStringProp.IsSet) - if (requiredClass.NotrequiredNullableStringProp.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp.Value); - else - writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuid.IsSet) - if (requiredClass.NotrequiredNullableUuid.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuid.Value.Value); - else - writer.WriteNull("notrequired_nullable_uuid"); - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs index 261fdb8d1758..86e7223ee957 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(Option varReturn = default) + public Return(int varReturn) { VarReturn = varReturn; OnCreated(); @@ -46,7 +45,7 @@ public Return(Option varReturn = default) /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public Option VarReturn { get; set; } + public int VarReturn { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varReturn = default; + int? varReturn = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = new Option(utf8JsonReader.GetInt32()); + varReturn = utf8JsonReader.GetInt32(); break; default: break; @@ -128,12 +127,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn.Value == null) - throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); + if (varReturn == null) + throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); - Option varReturnParsedValue = new Option(varReturn.Value.Value); - - return new Return(varReturnParsedValue); + return new Return(varReturn.Value); } /// @@ -160,8 +157,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - if (varReturn.VarReturn.IsSet) - writer.WriteNumber("return", varReturn.VarReturn.Value); + writer.WriteNumber("return", varReturn.VarReturn); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 54b27bd0611e..86effcebe7ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(Option role = default, Option roleUuid = default) + public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) { Role = role; RoleUuid = roleUuid; @@ -48,13 +47,13 @@ public RolesReportsHash(Option role = default, Option [JsonPropertyName("role")] - public Option Role { get; set; } + public RolesReportsHashRole Role { get; set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Option RoleUuid { get; set; } + public Guid RoleUuid { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option role = default; - Option roleUuid = default; + RolesReportsHashRole role = default; + Guid? roleUuid = default; while (utf8JsonReader.Read()) { @@ -130,11 +129,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = new Option(utf8JsonReader.GetGuid()); + roleUuid = utf8JsonReader.GetGuid(); break; default: break; @@ -142,16 +141,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role.Value == null) - throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); + if (role == null) + throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); - if (roleUuid.Value == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); + if (roleUuid == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); - Option roleParsedValue = new Option(role.Value); - Option roleUuidParsedValue = new Option(roleUuid.Value.Value); - - return new RolesReportsHash(roleParsedValue, roleUuidParsedValue); + return new RolesReportsHash(role, roleUuid.Value); } /// @@ -178,14 +174,9 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHash.Role.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - - if (rolesReportsHash.Role.IsSet) - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - if (rolesReportsHash.RoleUuid.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid.Value); + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index ef1ad83c5ac4..c7002b77b2e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(Option name = default) + public RolesReportsHashRole(string name) { Name = name; OnCreated(); @@ -46,7 +45,7 @@ public RolesReportsHashRole(Option name = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; + string name = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); - Option nameParsedValue = new Option(name.Value); - - return new RolesReportsHashRole(nameParsedValue); + return new RolesReportsHashRole(name); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - if (rolesReportsHashRole.Name.Value == null) - throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); - - if (rolesReportsHashRole.Name.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name.Value); + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 2252bd8cb94f..4151ead57dfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; - Option triangleType = default; + string shapeType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - - string shapeTypeParsedValue = shapeType.Value; - string triangleTypeParsedValue = triangleType.Value; - - return new ScaleneTriangle(shapeTypeParsedValue, triangleTypeParsedValue); + return new ScaleneTriangle(shapeType, triangleType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - if (scaleneTriangle.ShapeType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); - - if (scaleneTriangle.TriangleType == null) - throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - - writer.WriteString("shapeType", scaleneTriangle.ShapeType); writer.WriteString("triangleType", scaleneTriangle.TriangleType); + writer.WriteString("shapeType", scaleneTriangle.ShapeType); + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs index a65c260c9efb..dae0ef02f966 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeTypeParsedValue); + return new Shape(quadrilateral, shapeType); if (triangle != null) - return new Shape(triangle, shapeTypeParsedValue); + return new Shape(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - if (shape.ShapeType == null) - throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 526250148c57..de32fa535aec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - - string shapeTypeParsedValue = shapeType.Value; - - return new ShapeInterface(shapeTypeParsedValue); + return new ShapeInterface(shapeType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - if (shapeInterface.ShapeType == null) - throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index ccfbe3817dea..955461e12024 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -134,7 +133,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option shapeType = default; + string shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -185,7 +184,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -193,19 +192,14 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); - - string shapeTypeParsedValue = shapeType.Value; + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeTypeParsedValue); + return new ShapeOrNull(quadrilateral, shapeType); if (triangle != null) - return new ShapeOrNull(triangle, shapeTypeParsedValue); + return new ShapeOrNull(triangle, shapeType); throw new JsonException(); } @@ -244,9 +238,6 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - if (shapeOrNull.ShapeType == null) - throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 29a0757f6a6c..7f0b8a306f80 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -110,8 +109,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option quadrilateralType = default; - Option shapeType = default; + string quadrilateralType = default; + string shapeType = default; while (utf8JsonReader.Read()) { @@ -129,10 +128,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = new Option(utf8JsonReader.GetString()); + quadrilateralType = utf8JsonReader.GetString(); break; case "shapeType": - shapeType = new Option(utf8JsonReader.GetString()); + shapeType = utf8JsonReader.GetString(); break; default: break; @@ -140,22 +139,13 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (!quadrilateralType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); + if (quadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); - if (!shapeType.IsSet) - throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); + if (shapeType == null) + throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); - if (quadrilateralType.Value == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); - - if (shapeType.Value == null) - throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - - string quadrilateralTypeParsedValue = quadrilateralType.Value; - string shapeTypeParsedValue = shapeType.Value; - - return new SimpleQuadrilateral(quadrilateralTypeParsedValue, shapeTypeParsedValue); + return new SimpleQuadrilateral(quadrilateralType, shapeType); } /// @@ -182,13 +172,8 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - if (simpleQuadrilateral.QuadrilateralType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); - - if (simpleQuadrilateral.ShapeType == null) - throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index ff962f637f2d..8328ad3ee121 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) + public SpecialModelName(string varSpecialModelName, long specialPropertyName) { VarSpecialModelName = varSpecialModelName; SpecialPropertyName = specialPropertyName; @@ -48,13 +47,13 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonPropertyName("_special_model.name_")] - public Option VarSpecialModelName { get; set; } + public string VarSpecialModelName { get; set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public Option SpecialPropertyName { get; set; } + public long SpecialPropertyName { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option varSpecialModelName = default; - Option specialPropertyName = default; + string varSpecialModelName = default; + long? specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -129,11 +128,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = new Option(utf8JsonReader.GetString()); + varSpecialModelName = utf8JsonReader.GetString(); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = new Option(utf8JsonReader.GetInt64()); + specialPropertyName = utf8JsonReader.GetInt64(); break; default: break; @@ -141,16 +140,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); + if (varSpecialModelName == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); - if (specialPropertyName.Value == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); + if (specialPropertyName == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); - Option varSpecialModelNameParsedValue = new Option(varSpecialModelName.Value); - Option specialPropertyNameParsedValue = new Option(specialPropertyName.Value.Value); - - return new SpecialModelName(varSpecialModelNameParsedValue, specialPropertyNameParsedValue); + return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - if (specialModelName.VarSpecialModelName.Value == null) - throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); - - if (specialModelName.VarSpecialModelName.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName.Value); if (specialModelName.SpecialPropertyName.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName.Value); + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index 226c6f1e6fdf..6524d75edcf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(Option id = default, Option name = default) + public Tag(long id, string name) { Id = id; Name = name; @@ -48,13 +47,13 @@ public Tag(Option id = default, Option name = default) /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public Option Name { get; set; } + public string Name { get; set; } /// /// Gets or Sets additional properties @@ -110,8 +109,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option id = default; - Option name = default; + long? id = default; + string name = default; while (utf8JsonReader.Read()) { @@ -130,10 +129,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "name": - name = new Option(utf8JsonReader.GetString()); + name = utf8JsonReader.GetString(); break; default: break; @@ -141,16 +140,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); - if (name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); + if (name == null) + throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); - Option idParsedValue = new Option(id.Value.Value); - Option nameParsedValue = new Option(name.Value); - - return new Tag(idParsedValue, nameParsedValue); + return new Tag(id.Value, name); } /// @@ -177,12 +173,8 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - if (tag.Name.Value == null) - throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); - - if (tag.Id.IsSet) - writer.WriteNumber("id", tag.Id.Value); if (tag.Name.IsSet) - writer.WriteString("name", tag.Name.Value); + writer.WriteNumber("id", tag.Id); + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index f52b9e4a2b54..b2e110e79f67 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(Option value = default) + public TestCollectionEndingWithWordList(string value) { Value = value; OnCreated(); @@ -46,7 +45,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Gets or Sets Value /// [JsonPropertyName("value")] - public Option Value { get; set; } + public string Value { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option value = default; + string value = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = new Option(utf8JsonReader.GetString()); + value = utf8JsonReader.GetString(); break; default: break; @@ -127,12 +126,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value.Value == null) - throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); + if (value == null) + throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); - Option valueParsedValue = new Option(value.Value); - - return new TestCollectionEndingWithWordList(valueParsedValue); + return new TestCollectionEndingWithWordList(value); } /// @@ -159,11 +156,7 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordList.Value.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); - - if (testCollectionEndingWithWordList.Value.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value.Value); + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 4227a82c141a..8753edfd9f35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) + public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) { TestCollectionEndingWithWordList = testCollectionEndingWithWordList; OnCreated(); @@ -46,7 +45,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonPropertyName("TestCollectionEndingWithWordList")] - public Option> TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get; set; } /// /// Gets or Sets additional properties @@ -101,7 +100,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> testCollectionEndingWithWordList = default; + List testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -120,7 +119,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -128,12 +127,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - Option> testCollectionEndingWithWordListParsedValue = new Option>(testCollectionEndingWithWordList.Value); - - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordListParsedValue); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -160,12 +157,8 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.Value == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList.IsSet) - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 66ff4d3f740d..139e92b4c6a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() + public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() { SomeProperty = someProperty; OnCreated(); @@ -46,7 +45,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public Option SomeProperty { get; set; } + public string SomeProperty { get; set; } /// /// Gets or Sets additional properties @@ -112,7 +111,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option someProperty = default; + string someProperty = default; while (utf8JsonReader.Read()) { @@ -130,7 +129,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = new Option(utf8JsonReader.GetString()); + someProperty = utf8JsonReader.GetString(); break; default: break; @@ -138,12 +137,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty.Value == null) - throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty == null) + throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - Option somePropertyParsedValue = new Option(someProperty.Value); - - return new TestInlineFreeformAdditionalPropertiesRequest(somePropertyParsedValue); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -170,11 +167,7 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value == null) - throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); - - if (testInlineFreeformAdditionalPropertiesRequest.SomeProperty.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty.Value); + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs index d3f217b6df34..814316961f91 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -151,7 +150,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -208,7 +207,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -216,22 +215,17 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); - - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); - - string triangleTypeParsedValue = triangleType.Value; + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleTypeParsedValue); + return new Triangle(equilateralTriangle, triangleType); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleTypeParsedValue); + return new Triangle(isoscelesTriangle, triangleType); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleTypeParsedValue); + return new Triangle(scaleneTriangle, triangleType); throw new JsonException(); } @@ -275,9 +269,6 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - if (triangle.TriangleType == null) - throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 728872627f36..6bd1e4303a70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -101,7 +100,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option triangleType = default; + string triangleType = default; while (utf8JsonReader.Read()) { @@ -119,7 +118,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = new Option(utf8JsonReader.GetString()); + triangleType = utf8JsonReader.GetString(); break; default: break; @@ -127,15 +126,10 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (!triangleType.IsSet) - throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); + if (triangleType == null) + throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); - if (triangleType.Value == null) - throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - - string triangleTypeParsedValue = triangleType.Value; - - return new TriangleInterface(triangleTypeParsedValue); + return new TriangleInterface(triangleType); } /// @@ -162,9 +156,6 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - if (triangleInterface.TriangleType == null) - throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index a274f3d6e631..ea527b94ec08 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +44,7 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) { Email = email; FirstName = firstName; @@ -68,78 +67,78 @@ public User(Option email = default, Option firstName = default, /// Gets or Sets Email /// [JsonPropertyName("email")] - public Option Email { get; set; } + public string Email { get; set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public Option FirstName { get; set; } + public string FirstName { get; set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public Option Id { get; set; } + public long Id { get; set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public Option LastName { get; set; } + public string LastName { get; set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Option ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public Option Password { get; set; } + public string Password { get; set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public Option Phone { get; set; } + public string Phone { get; set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public Option UserStatus { get; set; } + public int UserStatus { get; set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public Option Username { get; set; } + public string Username { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Option AnyTypeProp { get; set; } + public Object AnyTypeProp { get; set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Option AnyTypePropNullable { get; set; } + public Object AnyTypePropNullable { get; set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Option ObjectWithNoDeclaredPropsNullable { get; set; } + public Object ObjectWithNoDeclaredPropsNullable { get; set; } /// /// Gets or Sets additional properties @@ -205,18 +204,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option email = default; - Option firstName = default; - Option id = default; - Option lastName = default; - Option objectWithNoDeclaredProps = default; - Option password = default; - Option phone = default; - Option userStatus = default; - Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; + string email = default; + string firstName = default; + long? id = default; + string lastName = default; + Object objectWithNoDeclaredProps = default; + string password = default; + string phone = default; + int? userStatus = default; + string username = default; + Object anyTypeProp = default; + Object anyTypePropNullable = default; + Object objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -234,46 +233,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = new Option(utf8JsonReader.GetString()); + email = utf8JsonReader.GetString(); break; case "firstName": - firstName = new Option(utf8JsonReader.GetString()); + firstName = utf8JsonReader.GetString(); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = new Option(utf8JsonReader.GetInt64()); + id = utf8JsonReader.GetInt64(); break; case "lastName": - lastName = new Option(utf8JsonReader.GetString()); + lastName = utf8JsonReader.GetString(); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "password": - password = new Option(utf8JsonReader.GetString()); + password = utf8JsonReader.GetString(); break; case "phone": - phone = new Option(utf8JsonReader.GetString()); + phone = utf8JsonReader.GetString(); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = new Option(utf8JsonReader.GetInt32()); + userStatus = utf8JsonReader.GetInt32(); break; case "username": - username = new Option(utf8JsonReader.GetString()); + username = utf8JsonReader.GetString(); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); break; default: break; @@ -281,44 +280,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email.Value == null) - throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); + if (email == null) + throw new ArgumentNullException(nameof(email), "Property is required for class User."); - if (firstName.Value == null) - throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); + if (firstName == null) + throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); - if (id.Value == null) - throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); + if (id == null) + throw new ArgumentNullException(nameof(id), "Property is required for class User."); - if (lastName.Value == null) - throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); + if (lastName == null) + throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); - if (objectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); + if (objectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); - if (password.Value == null) - throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); + if (password == null) + throw new ArgumentNullException(nameof(password), "Property is required for class User."); - if (phone.Value == null) - throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); + if (phone == null) + throw new ArgumentNullException(nameof(phone), "Property is required for class User."); - if (userStatus.Value == null) - throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); + if (userStatus == null) + throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); - if (username.Value == null) - throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); + if (username == null) + throw new ArgumentNullException(nameof(username), "Property is required for class User."); - Option emailParsedValue = new Option(email.Value); - Option firstNameParsedValue = new Option(firstName.Value); - Option idParsedValue = new Option(id.Value.Value); - Option lastNameParsedValue = new Option(lastName.Value); - Option objectWithNoDeclaredPropsParsedValue = new Option(objectWithNoDeclaredProps.Value); - Option passwordParsedValue = new Option(password.Value); - Option phoneParsedValue = new Option(phone.Value); - Option userStatusParsedValue = new Option(userStatus.Value.Value); - Option usernameParsedValue = new Option(username.Value); - - return new User(emailParsedValue, firstNameParsedValue, idParsedValue, lastNameParsedValue, objectWithNoDeclaredPropsParsedValue, passwordParsedValue, phoneParsedValue, userStatusParsedValue, usernameParsedValue, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -345,62 +334,22 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - if (user.Email.Value == null) - throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); - - if (user.FirstName.Value == null) - throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); - - if (user.LastName.Value == null) - throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); - - if (user.ObjectWithNoDeclaredProps.Value == null) - throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); - - if (user.Password.Value == null) - throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); - - if (user.Phone.Value == null) - throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); - - if (user.Username.Value == null) - throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); - - if (user.Email.IsSet) - writer.WriteString("email", user.Email.Value); if (user.FirstName.IsSet) - writer.WriteString("firstName", user.FirstName.Value); if (user.Id.IsSet) - writer.WriteNumber("id", user.Id.Value); if (user.LastName.IsSet) - writer.WriteString("lastName", user.LastName.Value); if (user.ObjectWithNoDeclaredProps.IsSet) - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - if (user.Password.IsSet) - writer.WriteString("password", user.Password.Value); if (user.Phone.IsSet) - writer.WriteString("phone", user.Phone.Value); if (user.UserStatus.IsSet) - writer.WriteNumber("userStatus", user.UserStatus.Value); if (user.Username.IsSet) - writer.WriteString("username", user.Username.Value); if (user.AnyTypeProp.IsSet) - if (user.AnyTypeProp.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullable.IsSet) - if (user.AnyTypePropNullable.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullable.IsSet) - if (user.ObjectWithNoDeclaredPropsNullable.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); + writer.WriteString("email", user.Email); + writer.WriteString("firstName", user.FirstName); + writer.WriteNumber("id", user.Id); + writer.WriteString("lastName", user.LastName); + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + writer.WriteString("password", user.Password); + writer.WriteString("phone", user.Phone); + writer.WriteNumber("userStatus", user.UserStatus); + writer.WriteString("username", user.Username); + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index 37036ab1f126..e633a5c92cf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,7 +35,7 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) + public Whale(string className, bool hasBaleen, bool hasTeeth) { ClassName = className; HasBaleen = hasBaleen; @@ -56,13 +55,13 @@ public Whale(string className, Option hasBaleen = default, Option ha /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public Option HasBaleen { get; set; } + public bool HasBaleen { get; set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public Option HasTeeth { get; set; } + public bool HasTeeth { get; set; } /// /// Gets or Sets additional properties @@ -119,9 +118,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option hasBaleen = default; - Option hasTeeth = default; + string className = default; + bool? hasBaleen = default; + bool? hasTeeth = default; while (utf8JsonReader.Read()) { @@ -139,15 +138,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = new Option(utf8JsonReader.GetBoolean()); + hasBaleen = utf8JsonReader.GetBoolean(); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = new Option(utf8JsonReader.GetBoolean()); + hasTeeth = utf8JsonReader.GetBoolean(); break; default: break; @@ -155,23 +154,16 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Whale.", nameof(className)); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); + if (hasBaleen == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); - if (hasBaleen.Value == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); + if (hasTeeth == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); - if (hasTeeth.Value == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - - string classNameParsedValue = className.Value; - Option hasBaleenParsedValue = new Option(hasBaleen.Value.Value); - Option hasTeethParsedValue = new Option(hasTeeth.Value.Value); - - return new Whale(classNameParsedValue, hasBaleenParsedValue, hasTeethParsedValue); + return new Whale(className, hasBaleen.Value, hasTeeth.Value); } /// @@ -198,12 +190,9 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - if (whale.ClassName == null) - throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - - writer.WriteString("className", whale.ClassName); if (whale.HasBaleen.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleen.Value); if (whale.HasTeeth.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeeth.Value); + writer.WriteString("className", whale.ClassName); + writer.WriteBoolean("hasBaleen", whale.HasBaleen); + writer.WriteBoolean("hasTeeth", whale.HasTeeth); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 9099a6a39579..52135d8a3c51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,7 +34,7 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, Option type = default) : base() + public Zebra(string className, TypeEnum type) : base() { ClassName = className; Type = type; @@ -112,6 +111,7 @@ public static TypeEnum TypeEnumFromString(string value) /// public static string TypeEnumToJsonValue(TypeEnum value) { + if (value == TypeEnum.Plains) return "plains"; @@ -128,7 +128,7 @@ public static string TypeEnumToJsonValue(TypeEnum value) /// Gets or Sets Type /// [JsonPropertyName("type")] - public Option Type { get; set; } + public TypeEnum Type { get; set; } /// /// Gets or Sets ClassName @@ -201,8 +201,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option className = default; - Option type = default; + string className = default; + Zebra.TypeEnum? type = default; while (utf8JsonReader.Read()) { @@ -220,12 +220,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = new Option(utf8JsonReader.GetString()); + className = utf8JsonReader.GetString(); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - if (typeRawValue != null) - type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); + type = typeRawValue == null + ? null + : Zebra.TypeEnumFromStringOrDefault(typeRawValue); break; default: break; @@ -233,19 +234,13 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (!className.IsSet) - throw new ArgumentException("Property is required for class Zebra.", nameof(className)); - - if (className.Value == null) - throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - - if (type.Value == null) - throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); + if (className == null) + throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); - string classNameParsedValue = className.Value; - Option typeParsedValue = new Option(type.Value.Value); + if (type == null) + throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); - return new Zebra(classNameParsedValue, typeParsedValue); + return new Zebra(className, type.Value); } /// @@ -272,10 +267,9 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - if (zebra.ClassName == null) - throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + writer.WriteString("className", zebra.ClassName); - writer.WriteString("className", zebra.ClassName); var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type.Value); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 34a044fb8b13..20e184f02b2b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 042dcb1ca2ad..7e5f3cdafcca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,7 +20,6 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; -using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,7 +33,7 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(Option zeroBasedEnum = default) + public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) { ZeroBasedEnum = zeroBasedEnum; OnCreated(); @@ -99,6 +98,7 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) { + if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -112,7 +112,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public Option ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } /// /// Gets or Sets additional properties @@ -167,7 +167,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option zeroBasedEnum = default; + ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -186,8 +186,9 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - if (zeroBasedEnumRawValue != null) - zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); + zeroBasedEnum = zeroBasedEnumRawValue == null + ? null + : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); break; default: break; @@ -195,12 +196,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum.Value == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - - Option zeroBasedEnumParsedValue = new Option(zeroBasedEnum.Value.Value); + if (zeroBasedEnum == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnumParsedValue); + return new ZeroBasedEnumClass(zeroBasedEnum.Value); } /// @@ -227,7 +226,8 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum.Value); + + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES index 3079e1bed81a..cfa6edb1db83 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -196,7 +195,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md index 45508dddfc61..18aa6dd26bc4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md @@ -246,7 +246,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 919ae3fc0fe8..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1043 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using FileParameter = Org.OpenAPITools.Client.FileParameter; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES index 1e54de3472d2..ddeca89d213f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -199,7 +198,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md index b344c43c38b5..2a3e242fe88d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md @@ -233,7 +233,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 90e0c44b40b8..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1042 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES index 1e54de3472d2..ddeca89d213f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -199,7 +198,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md index b344c43c38b5..2a3e242fe88d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md @@ -233,7 +233,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 90e0c44b40b8..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1042 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES index 1e54de3472d2..ddeca89d213f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -199,7 +198,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md index b344c43c38b5..2a3e242fe88d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md @@ -233,7 +233,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 90e0c44b40b8..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1042 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES index b73f11d50f17..b6dffff4f19f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES @@ -75,7 +75,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -195,7 +194,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md index 7397b3f98161..dcfb29678186 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md @@ -207,7 +207,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](Quadrilateral.md) - [Model.QuadrilateralInterface](QuadrilateralInterface.md) - [Model.ReadOnlyFirst](ReadOnlyFirst.md) - - [Model.RequiredClass](RequiredClass.md) - [Model.Return](Return.md) - [Model.RolesReportsHash](RolesReportsHash.md) - [Model.RolesReportsHashRole](RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 24f5e2325d28..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,410 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; -using NUnit.Framework; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Test] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Test] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Test] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Test] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Test] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Test] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Test] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Test] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Test] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Test] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Test] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Test] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Test] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Test] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Test] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Test] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Test] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Test] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Test] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Test] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Test] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Test] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Test] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Test] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Test] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Test] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Test] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Test] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Test] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Test] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Test] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Test] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Test] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Test] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Test] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Test] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Test] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - /// - /// Test the property 'RequiredNullableUuid' - /// - [Test] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Test] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Test] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Test] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Test] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Test] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Test] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Test] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index eb89d56999fc..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1224 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() { } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return this.Equals(input as RequiredClass); - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - if (input == null) - { - return false; - } - return - ( - this.RequiredNullableIntegerProp == input.RequiredNullableIntegerProp || - (this.RequiredNullableIntegerProp != null && - this.RequiredNullableIntegerProp.Equals(input.RequiredNullableIntegerProp)) - ) && - ( - this.RequiredNotnullableintegerProp == input.RequiredNotnullableintegerProp || - this.RequiredNotnullableintegerProp.Equals(input.RequiredNotnullableintegerProp) - ) && - ( - this.NotRequiredNullableIntegerProp == input.NotRequiredNullableIntegerProp || - (this.NotRequiredNullableIntegerProp != null && - this.NotRequiredNullableIntegerProp.Equals(input.NotRequiredNullableIntegerProp)) - ) && - ( - this.NotRequiredNotnullableintegerProp == input.NotRequiredNotnullableintegerProp || - this.NotRequiredNotnullableintegerProp.Equals(input.NotRequiredNotnullableintegerProp) - ) && - ( - this.RequiredNullableStringProp == input.RequiredNullableStringProp || - (this.RequiredNullableStringProp != null && - this.RequiredNullableStringProp.Equals(input.RequiredNullableStringProp)) - ) && - ( - this.RequiredNotnullableStringProp == input.RequiredNotnullableStringProp || - (this.RequiredNotnullableStringProp != null && - this.RequiredNotnullableStringProp.Equals(input.RequiredNotnullableStringProp)) - ) && - ( - this.NotrequiredNullableStringProp == input.NotrequiredNullableStringProp || - (this.NotrequiredNullableStringProp != null && - this.NotrequiredNullableStringProp.Equals(input.NotrequiredNullableStringProp)) - ) && - ( - this.NotrequiredNotnullableStringProp == input.NotrequiredNotnullableStringProp || - (this.NotrequiredNotnullableStringProp != null && - this.NotrequiredNotnullableStringProp.Equals(input.NotrequiredNotnullableStringProp)) - ) && - ( - this.RequiredNullableBooleanProp == input.RequiredNullableBooleanProp || - (this.RequiredNullableBooleanProp != null && - this.RequiredNullableBooleanProp.Equals(input.RequiredNullableBooleanProp)) - ) && - ( - this.RequiredNotnullableBooleanProp == input.RequiredNotnullableBooleanProp || - this.RequiredNotnullableBooleanProp.Equals(input.RequiredNotnullableBooleanProp) - ) && - ( - this.NotrequiredNullableBooleanProp == input.NotrequiredNullableBooleanProp || - (this.NotrequiredNullableBooleanProp != null && - this.NotrequiredNullableBooleanProp.Equals(input.NotrequiredNullableBooleanProp)) - ) && - ( - this.NotrequiredNotnullableBooleanProp == input.NotrequiredNotnullableBooleanProp || - this.NotrequiredNotnullableBooleanProp.Equals(input.NotrequiredNotnullableBooleanProp) - ) && - ( - this.RequiredNullableDateProp == input.RequiredNullableDateProp || - (this.RequiredNullableDateProp != null && - this.RequiredNullableDateProp.Equals(input.RequiredNullableDateProp)) - ) && - ( - this.RequiredNotNullableDateProp == input.RequiredNotNullableDateProp || - (this.RequiredNotNullableDateProp != null && - this.RequiredNotNullableDateProp.Equals(input.RequiredNotNullableDateProp)) - ) && - ( - this.NotRequiredNullableDateProp == input.NotRequiredNullableDateProp || - (this.NotRequiredNullableDateProp != null && - this.NotRequiredNullableDateProp.Equals(input.NotRequiredNullableDateProp)) - ) && - ( - this.NotRequiredNotnullableDateProp == input.NotRequiredNotnullableDateProp || - (this.NotRequiredNotnullableDateProp != null && - this.NotRequiredNotnullableDateProp.Equals(input.NotRequiredNotnullableDateProp)) - ) && - ( - this.RequiredNotnullableDatetimeProp == input.RequiredNotnullableDatetimeProp || - (this.RequiredNotnullableDatetimeProp != null && - this.RequiredNotnullableDatetimeProp.Equals(input.RequiredNotnullableDatetimeProp)) - ) && - ( - this.RequiredNullableDatetimeProp == input.RequiredNullableDatetimeProp || - (this.RequiredNullableDatetimeProp != null && - this.RequiredNullableDatetimeProp.Equals(input.RequiredNullableDatetimeProp)) - ) && - ( - this.NotrequiredNullableDatetimeProp == input.NotrequiredNullableDatetimeProp || - (this.NotrequiredNullableDatetimeProp != null && - this.NotrequiredNullableDatetimeProp.Equals(input.NotrequiredNullableDatetimeProp)) - ) && - ( - this.NotrequiredNotnullableDatetimeProp == input.NotrequiredNotnullableDatetimeProp || - (this.NotrequiredNotnullableDatetimeProp != null && - this.NotrequiredNotnullableDatetimeProp.Equals(input.NotrequiredNotnullableDatetimeProp)) - ) && - ( - this.RequiredNullableEnumInteger == input.RequiredNullableEnumInteger || - this.RequiredNullableEnumInteger.Equals(input.RequiredNullableEnumInteger) - ) && - ( - this.RequiredNotnullableEnumInteger == input.RequiredNotnullableEnumInteger || - this.RequiredNotnullableEnumInteger.Equals(input.RequiredNotnullableEnumInteger) - ) && - ( - this.NotrequiredNullableEnumInteger == input.NotrequiredNullableEnumInteger || - this.NotrequiredNullableEnumInteger.Equals(input.NotrequiredNullableEnumInteger) - ) && - ( - this.NotrequiredNotnullableEnumInteger == input.NotrequiredNotnullableEnumInteger || - this.NotrequiredNotnullableEnumInteger.Equals(input.NotrequiredNotnullableEnumInteger) - ) && - ( - this.RequiredNullableEnumIntegerOnly == input.RequiredNullableEnumIntegerOnly || - this.RequiredNullableEnumIntegerOnly.Equals(input.RequiredNullableEnumIntegerOnly) - ) && - ( - this.RequiredNotnullableEnumIntegerOnly == input.RequiredNotnullableEnumIntegerOnly || - this.RequiredNotnullableEnumIntegerOnly.Equals(input.RequiredNotnullableEnumIntegerOnly) - ) && - ( - this.NotrequiredNullableEnumIntegerOnly == input.NotrequiredNullableEnumIntegerOnly || - this.NotrequiredNullableEnumIntegerOnly.Equals(input.NotrequiredNullableEnumIntegerOnly) - ) && - ( - this.NotrequiredNotnullableEnumIntegerOnly == input.NotrequiredNotnullableEnumIntegerOnly || - this.NotrequiredNotnullableEnumIntegerOnly.Equals(input.NotrequiredNotnullableEnumIntegerOnly) - ) && - ( - this.RequiredNotnullableEnumString == input.RequiredNotnullableEnumString || - this.RequiredNotnullableEnumString.Equals(input.RequiredNotnullableEnumString) - ) && - ( - this.RequiredNullableEnumString == input.RequiredNullableEnumString || - this.RequiredNullableEnumString.Equals(input.RequiredNullableEnumString) - ) && - ( - this.NotrequiredNullableEnumString == input.NotrequiredNullableEnumString || - this.NotrequiredNullableEnumString.Equals(input.NotrequiredNullableEnumString) - ) && - ( - this.NotrequiredNotnullableEnumString == input.NotrequiredNotnullableEnumString || - this.NotrequiredNotnullableEnumString.Equals(input.NotrequiredNotnullableEnumString) - ) && - ( - this.RequiredNullableOuterEnumDefaultValue == input.RequiredNullableOuterEnumDefaultValue || - this.RequiredNullableOuterEnumDefaultValue.Equals(input.RequiredNullableOuterEnumDefaultValue) - ) && - ( - this.RequiredNotnullableOuterEnumDefaultValue == input.RequiredNotnullableOuterEnumDefaultValue || - this.RequiredNotnullableOuterEnumDefaultValue.Equals(input.RequiredNotnullableOuterEnumDefaultValue) - ) && - ( - this.NotrequiredNullableOuterEnumDefaultValue == input.NotrequiredNullableOuterEnumDefaultValue || - this.NotrequiredNullableOuterEnumDefaultValue.Equals(input.NotrequiredNullableOuterEnumDefaultValue) - ) && - ( - this.NotrequiredNotnullableOuterEnumDefaultValue == input.NotrequiredNotnullableOuterEnumDefaultValue || - this.NotrequiredNotnullableOuterEnumDefaultValue.Equals(input.NotrequiredNotnullableOuterEnumDefaultValue) - ) && - ( - this.RequiredNullableUuid == input.RequiredNullableUuid || - (this.RequiredNullableUuid != null && - this.RequiredNullableUuid.Equals(input.RequiredNullableUuid)) - ) && - ( - this.RequiredNotnullableUuid == input.RequiredNotnullableUuid || - (this.RequiredNotnullableUuid != null && - this.RequiredNotnullableUuid.Equals(input.RequiredNotnullableUuid)) - ) && - ( - this.NotrequiredNullableUuid == input.NotrequiredNullableUuid || - (this.NotrequiredNullableUuid != null && - this.NotrequiredNullableUuid.Equals(input.NotrequiredNullableUuid)) - ) && - ( - this.NotrequiredNotnullableUuid == input.NotrequiredNotnullableUuid || - (this.NotrequiredNotnullableUuid != null && - this.NotrequiredNotnullableUuid.Equals(input.NotrequiredNotnullableUuid)) - ) && - ( - this.RequiredNullableArrayOfString == input.RequiredNullableArrayOfString || - this.RequiredNullableArrayOfString != null && - input.RequiredNullableArrayOfString != null && - this.RequiredNullableArrayOfString.SequenceEqual(input.RequiredNullableArrayOfString) - ) && - ( - this.RequiredNotnullableArrayOfString == input.RequiredNotnullableArrayOfString || - this.RequiredNotnullableArrayOfString != null && - input.RequiredNotnullableArrayOfString != null && - this.RequiredNotnullableArrayOfString.SequenceEqual(input.RequiredNotnullableArrayOfString) - ) && - ( - this.NotrequiredNullableArrayOfString == input.NotrequiredNullableArrayOfString || - this.NotrequiredNullableArrayOfString != null && - input.NotrequiredNullableArrayOfString != null && - this.NotrequiredNullableArrayOfString.SequenceEqual(input.NotrequiredNullableArrayOfString) - ) && - ( - this.NotrequiredNotnullableArrayOfString == input.NotrequiredNotnullableArrayOfString || - this.NotrequiredNotnullableArrayOfString != null && - input.NotrequiredNotnullableArrayOfString != null && - this.NotrequiredNotnullableArrayOfString.SequenceEqual(input.NotrequiredNotnullableArrayOfString) - ); - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - return hashCode; - } - } - - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES index 0af518f942ac..f69e6ba1aba7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,7 +197,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index c2d5ddeb3539..af827f28641e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -221,7 +221,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 90e0c44b40b8..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1042 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() - { - this.AdditionalProperties = new Dictionary(); - } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - this.AdditionalProperties = new Dictionary(); - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets additional properties - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.AdditionalProperties != null) - { - hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES index 0af518f942ac..f69e6ba1aba7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES @@ -77,7 +77,6 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md -docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,7 +197,6 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs -src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/README.md b/samples/client/petstore/csharp/OpenAPIClientCore/README.md index b344c43c38b5..2a3e242fe88d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/README.md @@ -233,7 +233,6 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index 70e89968fbe5..f6eeaf555f13 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -1946,264 +1946,6 @@ components: nullable: true type: string type: object - RequiredClass: - properties: - required_nullable_integer_prop: - nullable: true - type: integer - required_notnullableinteger_prop: - nullable: false - type: integer - not_required_nullable_integer_prop: - nullable: true - type: integer - not_required_notnullableinteger_prop: - nullable: false - type: integer - required_nullable_string_prop: - nullable: true - type: string - required_notnullable_string_prop: - nullable: false - type: string - notrequired_nullable_string_prop: - nullable: true - type: string - notrequired_notnullable_string_prop: - nullable: false - type: string - required_nullable_boolean_prop: - nullable: true - type: boolean - required_notnullable_boolean_prop: - nullable: false - type: boolean - notrequired_nullable_boolean_prop: - nullable: true - type: boolean - notrequired_notnullable_boolean_prop: - nullable: false - type: boolean - required_nullable_date_prop: - format: date - nullable: true - type: string - required_not_nullable_date_prop: - format: date - nullable: false - type: string - not_required_nullable_date_prop: - format: date - nullable: true - type: string - not_required_notnullable_date_prop: - format: date - nullable: false - type: string - required_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_nullable_datetime_prop: - format: date-time - nullable: true - type: string - notrequired_notnullable_datetime_prop: - format: date-time - nullable: false - type: string - required_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - required_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - notrequired_nullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: true - type: integer - notrequired_notnullable_enum_integer: - enum: - - 1 - - -1 - format: int32 - nullable: false - type: integer - required_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - required_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - notrequired_nullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: true - type: integer - notrequired_notnullable_enum_integer_only: - enum: - - 2 - - -2 - nullable: false - type: integer - required_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_nullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: true - type: string - notrequired_notnullable_enum_string: - enum: - - UPPER - - lower - - "" - - "Value\twith tab" - - Value with " quote - - Value with escaped \" quote - - |- - Duplicate - value - - "Duplicate\r\nvalue" - nullable: false - type: string - required_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - required_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - notrequired_nullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: true - notrequired_notnullable_outerEnumDefaultValue: - allOf: - - $ref: '#/components/schemas/OuterEnumDefaultValue' - nullable: false - required_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - required_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - notrequired_nullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: true - type: string - notrequired_notnullable_uuid: - example: 72f98069-206d-4f12-9f12-3d1e525a8e84 - format: uuid - nullable: false - type: string - required_nullable_array_of_string: - items: - type: string - nullable: true - type: array - required_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - notrequired_nullable_array_of_string: - items: - type: string - nullable: true - type: array - notrequired_notnullable_array_of_string: - items: - type: string - nullable: false - type: array - required: - - required_not_nullable_date_prop - - required_notnullable_array_of_string - - required_notnullable_boolean_prop - - required_notnullable_datetime_prop - - required_notnullable_enum_integer - - required_notnullable_enum_integer_only - - required_notnullable_enum_string - - required_notnullable_outerEnumDefaultValue - - required_notnullable_string_prop - - required_notnullable_uuid - - required_notnullableinteger_prop - - required_nullable_array_of_string - - required_nullable_boolean_prop - - required_nullable_date_prop - - required_nullable_datetime_prop - - required_nullable_enum_integer - - required_nullable_enum_integer_only - - required_nullable_enum_string - - required_nullable_integer_prop - - required_nullable_outerEnumDefaultValue - - required_nullable_string_prop - - required_nullable_uuid - type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md deleted file mode 100644 index 07b6f018f6c1..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md +++ /dev/null @@ -1,53 +0,0 @@ -# Org.OpenAPITools.Model.RequiredClass - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**RequiredNullableIntegerProp** | **int?** | | -**RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNullableIntegerProp** | **int?** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**RequiredNullableStringProp** | **string** | | -**RequiredNotnullableStringProp** | **string** | | -**NotrequiredNullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**RequiredNullableBooleanProp** | **bool?** | | -**RequiredNotnullableBooleanProp** | **bool** | | -**NotrequiredNullableBooleanProp** | **bool?** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**RequiredNullableDateProp** | **DateTime?** | | -**RequiredNotNullableDateProp** | **DateTime** | | -**NotRequiredNullableDateProp** | **DateTime?** | | [optional] -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**RequiredNotnullableDatetimeProp** | **DateTime** | | -**RequiredNullableDatetimeProp** | **DateTime?** | | -**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**RequiredNullableEnumInteger** | **int?** | | -**RequiredNotnullableEnumInteger** | **int** | | -**NotrequiredNullableEnumInteger** | **int?** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**RequiredNullableEnumIntegerOnly** | **int?** | | -**RequiredNotnullableEnumIntegerOnly** | **int** | | -**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**RequiredNotnullableEnumString** | **string** | | -**RequiredNullableEnumString** | **string** | | -**NotrequiredNullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | -**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**RequiredNullableUuid** | **Guid?** | | -**RequiredNotnullableUuid** | **Guid** | | -**NotrequiredNullableUuid** | **Guid?** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] -**RequiredNullableArrayOfString** | **List<string>** | | -**RequiredNotnullableArrayOfString** | **List<string>** | | -**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs deleted file mode 100644 index 17de04feade0..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Xunit; - -using System; -using System.Linq; -using System.IO; -using System.Collections.Generic; -using Org.OpenAPITools.Model; -using Org.OpenAPITools.Client; -using System.Reflection; -using Newtonsoft.Json; - -namespace Org.OpenAPITools.Test.Model -{ - /// - /// Class for testing RequiredClass - /// - /// - /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). - /// Please update the test case below to test the model. - /// - public class RequiredClassTests : IDisposable - { - // TODO uncomment below to declare an instance variable for RequiredClass - //private RequiredClass instance; - - public RequiredClassTests() - { - // TODO uncomment below to create an instance of RequiredClass - //instance = new RequiredClass(); - } - - public void Dispose() - { - // Cleanup when everything is done. - } - - /// - /// Test an instance of RequiredClass - /// - [Fact] - public void RequiredClassInstanceTest() - { - // TODO uncomment below to test "IsType" RequiredClass - //Assert.IsType(instance); - } - - /// - /// Test the property 'RequiredNullableIntegerProp' - /// - [Fact] - public void RequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'RequiredNullableIntegerProp' - } - - /// - /// Test the property 'RequiredNotnullableintegerProp' - /// - [Fact] - public void RequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'RequiredNotnullableintegerProp' - } - - /// - /// Test the property 'NotRequiredNullableIntegerProp' - /// - [Fact] - public void NotRequiredNullableIntegerPropTest() - { - // TODO unit test for the property 'NotRequiredNullableIntegerProp' - } - - /// - /// Test the property 'NotRequiredNotnullableintegerProp' - /// - [Fact] - public void NotRequiredNotnullableintegerPropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableintegerProp' - } - - /// - /// Test the property 'RequiredNullableStringProp' - /// - [Fact] - public void RequiredNullableStringPropTest() - { - // TODO unit test for the property 'RequiredNullableStringProp' - } - - /// - /// Test the property 'RequiredNotnullableStringProp' - /// - [Fact] - public void RequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'RequiredNotnullableStringProp' - } - - /// - /// Test the property 'NotrequiredNullableStringProp' - /// - [Fact] - public void NotrequiredNullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNullableStringProp' - } - - /// - /// Test the property 'NotrequiredNotnullableStringProp' - /// - [Fact] - public void NotrequiredNotnullableStringPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableStringProp' - } - - /// - /// Test the property 'RequiredNullableBooleanProp' - /// - [Fact] - public void RequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNullableBooleanProp' - } - - /// - /// Test the property 'RequiredNotnullableBooleanProp' - /// - [Fact] - public void RequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'RequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNullableBooleanProp' - /// - [Fact] - public void NotrequiredNullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNullableBooleanProp' - } - - /// - /// Test the property 'NotrequiredNotnullableBooleanProp' - /// - [Fact] - public void NotrequiredNotnullableBooleanPropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' - } - - /// - /// Test the property 'RequiredNullableDateProp' - /// - [Fact] - public void RequiredNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNullableDateProp' - } - - /// - /// Test the property 'RequiredNotNullableDateProp' - /// - [Fact] - public void RequiredNotNullableDatePropTest() - { - // TODO unit test for the property 'RequiredNotNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNullableDateProp' - /// - [Fact] - public void NotRequiredNullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNullableDateProp' - } - - /// - /// Test the property 'NotRequiredNotnullableDateProp' - /// - [Fact] - public void NotRequiredNotnullableDatePropTest() - { - // TODO unit test for the property 'NotRequiredNotnullableDateProp' - } - - /// - /// Test the property 'RequiredNotnullableDatetimeProp' - /// - [Fact] - public void RequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableDatetimeProp' - /// - [Fact] - public void RequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'RequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNullableDatetimeProp' - /// - [Fact] - public void NotrequiredNullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNullableDatetimeProp' - } - - /// - /// Test the property 'NotrequiredNotnullableDatetimeProp' - /// - [Fact] - public void NotrequiredNotnullableDatetimePropTest() - { - // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' - } - - /// - /// Test the property 'RequiredNullableEnumInteger' - /// - [Fact] - public void RequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNullableEnumInteger' - } - - /// - /// Test the property 'RequiredNotnullableEnumInteger' - /// - [Fact] - public void RequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNullableEnumInteger' - /// - [Fact] - public void NotrequiredNullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumInteger' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumInteger' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' - } - - /// - /// Test the property 'RequiredNullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void RequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' - /// - [Fact] - public void NotrequiredNotnullableEnumIntegerOnlyTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' - } - - /// - /// Test the property 'RequiredNotnullableEnumString' - /// - [Fact] - public void RequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableEnumString' - /// - [Fact] - public void RequiredNullableEnumStringTest() - { - // TODO unit test for the property 'RequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNullableEnumString' - /// - [Fact] - public void NotrequiredNullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNullableEnumString' - } - - /// - /// Test the property 'NotrequiredNotnullableEnumString' - /// - [Fact] - public void NotrequiredNotnullableEnumStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableEnumString' - } - - /// - /// Test the property 'RequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void RequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' - /// - [Fact] - public void NotrequiredNotnullableOuterEnumDefaultValueTest() - { - // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' - } - - /// - /// Test the property 'RequiredNullableUuid' - /// - [Fact] - public void RequiredNullableUuidTest() - { - // TODO unit test for the property 'RequiredNullableUuid' - } - - /// - /// Test the property 'RequiredNotnullableUuid' - /// - [Fact] - public void RequiredNotnullableUuidTest() - { - // TODO unit test for the property 'RequiredNotnullableUuid' - } - - /// - /// Test the property 'NotrequiredNullableUuid' - /// - [Fact] - public void NotrequiredNullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNullableUuid' - } - - /// - /// Test the property 'NotrequiredNotnullableUuid' - /// - [Fact] - public void NotrequiredNotnullableUuidTest() - { - // TODO unit test for the property 'NotrequiredNotnullableUuid' - } - - /// - /// Test the property 'RequiredNullableArrayOfString' - /// - [Fact] - public void RequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNullableArrayOfString' - } - - /// - /// Test the property 'RequiredNotnullableArrayOfString' - /// - [Fact] - public void RequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'RequiredNotnullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNullableArrayOfString' - /// - [Fact] - public void NotrequiredNullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNullableArrayOfString' - } - - /// - /// Test the property 'NotrequiredNotnullableArrayOfString' - /// - [Fact] - public void NotrequiredNotnullableArrayOfStringTest() - { - // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' - } - } -} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs deleted file mode 100644 index 9e1e29271350..000000000000 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs +++ /dev/null @@ -1,1027 +0,0 @@ -/* - * OpenAPI Petstore - * - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.IO; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using System.ComponentModel.DataAnnotations; -using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; -using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; - -namespace Org.OpenAPITools.Model -{ - /// - /// RequiredClass - /// - [DataContract(Name = "RequiredClass")] - public partial class RequiredClass : IEquatable, IValidatableObject - { - /// - /// Defines RequiredNullableEnumInteger - /// - public enum RequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNullableEnumInteger - /// - [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } - /// - /// Defines RequiredNotnullableEnumInteger - /// - public enum RequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumInteger - /// - [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNullableEnumInteger - /// - public enum NotrequiredNullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumInteger - /// - [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } - /// - /// Defines NotrequiredNotnullableEnumInteger - /// - public enum NotrequiredNotnullableEnumIntegerEnum - { - /// - /// Enum NUMBER_1 for value: 1 - /// - NUMBER_1 = 1, - - /// - /// Enum NUMBER_MINUS_1 for value: -1 - /// - NUMBER_MINUS_1 = -1 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger - /// - [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } - /// - /// Defines RequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumIntegerOnly - /// - public enum RequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNullableEnumIntegerOnly - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } - /// - /// Defines NotrequiredNotnullableEnumIntegerOnly - /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 - /// - NUMBER_2 = 2, - - /// - /// Enum NUMBER_MINUS_2 for value: -2 - /// - NUMBER_MINUS_2 = -2 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly - /// - [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } - /// - /// Defines RequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNotnullableEnumString - /// - [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } - /// - /// Defines RequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets RequiredNullableEnumString - /// - [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] - public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNullableEnumString - /// - [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } - /// - /// Defines NotrequiredNotnullableEnumString - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum NotrequiredNotnullableEnumStringEnum - { - /// - /// Enum UPPER for value: UPPER - /// - [EnumMember(Value = "UPPER")] - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - [EnumMember(Value = "lower")] - Lower = 2, - - /// - /// Enum Empty for value: - /// - [EnumMember(Value = "")] - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - [EnumMember(Value = "Value\twith tab")] - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - [EnumMember(Value = "Value with \" quote")] - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - [EnumMember(Value = "Value with escaped \" quote")] - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - [EnumMember(Value = "Duplicate\nvalue")] - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - [EnumMember(Value = "Duplicate\r\nvalue")] - Duplicatevalue2 = 8 - } - - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } - - /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue - /// - [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } - /// - /// Initializes a new instance of the class. - /// - [JsonConstructorAttribute] - protected RequiredClass() { } - /// - /// Initializes a new instance of the class. - /// - /// requiredNullableIntegerProp (required). - /// requiredNotnullableintegerProp (required). - /// notRequiredNullableIntegerProp. - /// notRequiredNotnullableintegerProp. - /// requiredNullableStringProp (required). - /// requiredNotnullableStringProp (required). - /// notrequiredNullableStringProp. - /// notrequiredNotnullableStringProp. - /// requiredNullableBooleanProp (required). - /// requiredNotnullableBooleanProp (required). - /// notrequiredNullableBooleanProp. - /// notrequiredNotnullableBooleanProp. - /// requiredNullableDateProp (required). - /// requiredNotNullableDateProp (required). - /// notRequiredNullableDateProp. - /// notRequiredNotnullableDateProp. - /// requiredNotnullableDatetimeProp (required). - /// requiredNullableDatetimeProp (required). - /// notrequiredNullableDatetimeProp. - /// notrequiredNotnullableDatetimeProp. - /// requiredNullableEnumInteger (required). - /// requiredNotnullableEnumInteger (required). - /// notrequiredNullableEnumInteger. - /// notrequiredNotnullableEnumInteger. - /// requiredNullableEnumIntegerOnly (required). - /// requiredNotnullableEnumIntegerOnly (required). - /// notrequiredNullableEnumIntegerOnly. - /// notrequiredNotnullableEnumIntegerOnly. - /// requiredNotnullableEnumString (required). - /// requiredNullableEnumString (required). - /// notrequiredNullableEnumString. - /// notrequiredNotnullableEnumString. - /// requiredNullableOuterEnumDefaultValue (required). - /// requiredNotnullableOuterEnumDefaultValue (required). - /// notrequiredNullableOuterEnumDefaultValue. - /// notrequiredNotnullableOuterEnumDefaultValue. - /// requiredNullableUuid (required). - /// requiredNotnullableUuid (required). - /// notrequiredNullableUuid. - /// notrequiredNotnullableUuid. - /// requiredNullableArrayOfString (required). - /// requiredNotnullableArrayOfString (required). - /// notrequiredNullableArrayOfString. - /// notrequiredNotnullableArrayOfString. - public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) - { - // to ensure "requiredNullableIntegerProp" is required (not null) - if (requiredNullableIntegerProp == null) - { - throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableIntegerProp = requiredNullableIntegerProp; - this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - // to ensure "requiredNullableStringProp" is required (not null) - if (requiredNullableStringProp == null) - { - throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableStringProp = requiredNullableStringProp; - // to ensure "requiredNotnullableStringProp" is required (not null) - if (requiredNotnullableStringProp == null) - { - throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableStringProp = requiredNotnullableStringProp; - // to ensure "requiredNullableBooleanProp" is required (not null) - if (requiredNullableBooleanProp == null) - { - throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableBooleanProp = requiredNullableBooleanProp; - this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; - // to ensure "requiredNullableDateProp" is required (not null) - if (requiredNullableDateProp == null) - { - throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDateProp = requiredNullableDateProp; - this.RequiredNotNullableDateProp = requiredNotNullableDateProp; - this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; - // to ensure "requiredNullableDatetimeProp" is required (not null) - if (requiredNullableDatetimeProp == null) - { - throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; - this.RequiredNullableEnumInteger = requiredNullableEnumInteger; - this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; - this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; - this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; - this.RequiredNotnullableEnumString = requiredNotnullableEnumString; - this.RequiredNullableEnumString = requiredNullableEnumString; - this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; - this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; - // to ensure "requiredNullableUuid" is required (not null) - if (requiredNullableUuid == null) - { - throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableUuid = requiredNullableUuid; - this.RequiredNotnullableUuid = requiredNotnullableUuid; - // to ensure "requiredNullableArrayOfString" is required (not null) - if (requiredNullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNullableArrayOfString = requiredNullableArrayOfString; - // to ensure "requiredNotnullableArrayOfString" is required (not null) - if (requiredNotnullableArrayOfString == null) - { - throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); - } - this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; - this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; - this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; - this.NotrequiredNullableStringProp = notrequiredNullableStringProp; - this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; - this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; - this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; - this.NotRequiredNullableDateProp = notRequiredNullableDateProp; - this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; - this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; - this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; - this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; - this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; - this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; - this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; - this.NotrequiredNullableEnumString = notrequiredNullableEnumString; - this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; - this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; - this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; - this.NotrequiredNullableUuid = notrequiredNullableUuid; - this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; - this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; - this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; - } - - /// - /// Gets or Sets RequiredNullableIntegerProp - /// - [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] - public int? RequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableintegerProp - /// - [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] - public int RequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableIntegerProp - /// - [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] - public int? NotRequiredNullableIntegerProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableintegerProp - /// - [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] - public int NotRequiredNotnullableintegerProp { get; set; } - - /// - /// Gets or Sets RequiredNullableStringProp - /// - [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableStringProp - /// - [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] - public string RequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableStringProp - /// - [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] - public string NotrequiredNullableStringProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableStringProp - /// - [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] - public string NotrequiredNotnullableStringProp { get; set; } - - /// - /// Gets or Sets RequiredNullableBooleanProp - /// - [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool? RequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableBooleanProp - /// - [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] - public bool RequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableBooleanProp - /// - [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] - public bool? NotrequiredNullableBooleanProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableBooleanProp - /// - [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] - public bool NotrequiredNotnullableBooleanProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDateProp - /// - [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? RequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotNullableDateProp - /// - [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime RequiredNotNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNullableDateProp - /// - [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime? NotRequiredNullableDateProp { get; set; } - - /// - /// Gets or Sets NotRequiredNotnullableDateProp - /// - [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] - [JsonConverter(typeof(OpenAPIDateConverter))] - public DateTime NotRequiredNotnullableDateProp { get; set; } - - /// - /// Gets or Sets RequiredNotnullableDatetimeProp - /// - [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime RequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableDatetimeProp - /// - [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] - public DateTime? RequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNullableDatetimeProp - /// - [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] - public DateTime? NotrequiredNullableDatetimeProp { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp - /// - [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] - public DateTime NotrequiredNotnullableDatetimeProp { get; set; } - - /// - /// Gets or Sets RequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid? RequiredNullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] - public Guid RequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] - public Guid? NotrequiredNullableUuid { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] - public Guid NotrequiredNotnullableUuid { get; set; } - - /// - /// Gets or Sets RequiredNullableArrayOfString - /// - [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets RequiredNotnullableArrayOfString - /// - [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] - public List RequiredNotnullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNullableArrayOfString - /// - [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] - public List NotrequiredNullableArrayOfString { get; set; } - - /// - /// Gets or Sets NotrequiredNotnullableArrayOfString - /// - [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] - public List NotrequiredNotnullableArrayOfString { get; set; } - - /// - /// Returns the string presentation of the object - /// - /// String presentation of the object - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("class RequiredClass {\n"); - sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); - sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); - sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); - sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); - sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); - sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); - sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); - sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); - sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); - sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append("}\n"); - return sb.ToString(); - } - - /// - /// Returns the JSON string presentation of the object - /// - /// JSON string presentation of the object - public virtual string ToJson() - { - return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); - } - - /// - /// Returns true if objects are equal - /// - /// Object to be compared - /// Boolean - public override bool Equals(object input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; - } - - /// - /// Returns true if RequiredClass instances are equal - /// - /// Instance of RequiredClass to be compared - /// Boolean - public bool Equals(RequiredClass input) - { - return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; - } - - /// - /// Gets the hash code - /// - /// Hash code - public override int GetHashCode() - { - unchecked // Overflow is fine, just wrap - { - int hashCode = 41; - if (this.RequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); - if (this.NotRequiredNullableIntegerProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); - if (this.RequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); - } - if (this.RequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); - } - if (this.NotrequiredNullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); - } - if (this.NotrequiredNotnullableStringProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); - } - if (this.RequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); - if (this.NotrequiredNullableBooleanProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); - if (this.RequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); - } - if (this.RequiredNotNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); - } - if (this.NotRequiredNotnullableDateProp != null) - { - hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); - } - if (this.RequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); - } - if (this.RequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); - } - if (this.NotrequiredNotnullableDatetimeProp != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); - } - hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); - hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); - if (this.RequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); - } - if (this.RequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); - } - if (this.NotrequiredNullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); - } - if (this.NotrequiredNotnullableUuid != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); - } - if (this.RequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); - } - if (this.RequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); - } - if (this.NotrequiredNotnullableArrayOfString != null) - { - hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); - } - return hashCode; - } - } - - /// - /// To validate all properties of the instance - /// - /// Validation context - /// Validation Result - IEnumerable IValidatableObject.Validate(ValidationContext validationContext) - { - yield break; - } - } - -} From 37a602d9dc4f821cda173de5fa53a1ab00c4302b Mon Sep 17 00:00:00 2001 From: devhl Date: Tue, 31 Oct 2023 20:50:40 -0400 Subject: [PATCH 12/23] sample build is working, need to remove warnings --- .../csharp/libraries/generichost/modelGeneric.mustache | 2 +- .../src/main/resources/csharp/modelInnerEnum.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index ac64f42e60a7..750b196a36cc 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -20,7 +20,7 @@ {{#composedSchemas.anyOf}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; {{/composedSchemas.anyOf}} - {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; + {{name}} = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}; {{#allVars}} {{^isInherited}} {{name}}{{^required}}Option{{/required}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; diff --git a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache index 3ea602546391..0f484b0552e8 100644 --- a/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/modelInnerEnum.mustache @@ -74,7 +74,7 @@ {{#isString}} /// {{/isString}} - public static {{>EnumValueDataType}}{{#nrt}}{{#isString}}{{>NullConditionalProperty}}{{/isString}}{{/nrt}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} value) + public static {{>EnumValueDataType}}{{#nrt}}{{#isString}}{{#isNullable}}{{nrt?}} {{^nrt}}{{#vendorExtensions.x-is-value-type}}? {{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}{{/isString}}{{/nrt}} {{datatypeWithEnum}}ToJsonValue({{datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}{{#isString}}{{>NullConditionalProperty}}{{/isString}} value) { {{^isString}} return ({{>EnumValueDataType}}) value; From 2383dd20f0cbe372f95fb2a8ab585885b1341db3 Mon Sep 17 00:00:00 2001 From: devhl Date: Wed, 1 Nov 2023 19:25:11 -0400 Subject: [PATCH 13/23] fixed warnings in .net 7 with nrt --- .../languages/AbstractCSharpCodegen.java | 9 +++-- .../templating/mustache/PasteLambda.java | 8 +++- .../resources/csharp/ValidateRegex.mustache | 11 ++++- .../generichost/JsonConverter.mustache | 40 ++++++------------- .../generichost/ValidateRegex.mustache | 7 ++++ .../generichost/modelGeneric.mustache | 10 ++++- 6 files changed, 50 insertions(+), 35 deletions(-) create mode 100644 modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index ffe7d62a1054..2f99a61a8b84 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -433,13 +433,14 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("indentLine1", new IndentedLambda(4, " ", true, true)) .put("indentLine3", new IndentedLambda(12, " ", true, true)) .put("indentLine4", new IndentedLambda(16, " ", true, true)) - // .put("uniqueLinesWithNewLine", new UniqueLambda("\n", true)) + .put("uniqueLinesWithNewLine", new UniqueLambda("\n", true)) .put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda(true)) .put("copy", copyLambda) .put("copy2", copyLambda2) - .put("paste", new PasteLambda(copyLambda, true, true, true)) - .put("pasteLine", new PasteLambda(copyLambda, true, true, false)) - .put("pasteLine2", new PasteLambda(copyLambda2, true, true, false)); + .put("paste", new PasteLambda(copyLambda, true, true, true, false)) + .put("pasteOnce", new PasteLambda(copyLambda, true, true, true, true)) + .put("pasteLine", new PasteLambda(copyLambda, true, true, false, false)) + .put("pasteLine2", new PasteLambda(copyLambda2, true, true, false, false)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java index 43c8bf226114..c9d5e0146bb2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java @@ -40,12 +40,14 @@ public class PasteLambda implements Mustache.Lambda { private final Boolean stripLeading; private final Boolean stripTrailing; private final Boolean endWithLineBreak; + private final Boolean clear; - public PasteLambda(CopyLambda copyLambda, Boolean stripLeading, Boolean stripTrailing, Boolean endWithLineBreak) { + public PasteLambda(CopyLambda copyLambda, Boolean stripLeading, Boolean stripTrailing, Boolean endWithLineBreak, boolean clear) { this.copyLambda = copyLambda; this.stripLeading = stripLeading; this.stripTrailing = stripTrailing; this.endWithLineBreak = endWithLineBreak; + this.clear = clear; } @Override @@ -62,5 +64,9 @@ public void execute(Fragment fragment, Writer writer) throws IOException { content = content + "\n"; } writer.write(content); + + if (this.clear) { + this.copyLambda.savedContent = null; + } } } diff --git a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache index 014af91d9efc..dd208dafacea 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache @@ -1,6 +1,13 @@ // {{{name}}} ({{{dataType}}}) pattern Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); -if (!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) +if (this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null && !regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); -} \ No newline at end of file +} + + + + + + +// TODO: revert changes here \ No newline at end of file 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 a12d6047fb8b..191ef894231e 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 @@ -275,25 +275,12 @@ {{/isNullable}} {{/allVars}} - {{#allVars}} - {{#required}} - // {{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}{{>NullConditionalProperty}} {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}}; - {{/required}} - {{^required}} - {{^isNullable}} - // Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}> {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{#isInnerEnum}}{{^isMap}}{{classname}}.{{/isMap}}{{/isInnerEnum}}{{{datatypeWithEnum}}}>({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}); - {{/isNullable}} - {{/required}} - {{#-last}} - - {{/-last}} - {{/allVars}} {{^vendorExtensions.x-duplicated-data-type}} {{#model.discriminator}} {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value!{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c {{#-last}} throw new JsonException(); @@ -304,7 +291,6 @@ {{^composedSchemas.oneOf}} {{^required}} {{#model.composedSchemas.anyOf}} - // Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); Option<{{baseType}}{{>NullConditionalProperty}}> {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue = {{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}} == null ? default : new Option<{{baseType}}{{>NullConditionalProperty}}>({{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}); @@ -313,7 +299,7 @@ {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}!.Value!{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value!{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value!{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} @@ -408,7 +394,7 @@ {{/isString}} {{#isBoolean}} {{#lambda.copy}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -417,7 +403,7 @@ {{^isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -426,7 +412,7 @@ {{/isEnum}} {{#isDate}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -434,7 +420,7 @@ {{/isDate}} {{#isDateTime}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -443,7 +429,7 @@ {{#isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -452,7 +438,7 @@ {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 7 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}!.Value{{/isNullable}}{{/required}}); // 7 if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -469,7 +455,7 @@ writer.WriteNull("{{baseName}}"); else { - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); // 8a {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -507,9 +493,9 @@ {{^required}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 10 {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value != null) // 10 a + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option!.Value != null) // 10 a { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value.Value); + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value!.Value); // 10 c writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } else @@ -517,7 +503,7 @@ {{/isNullable}} {{^isNullable}} { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); // 10 b + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}!.Value); // 10 b writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } {{/isNullable}} @@ -528,7 +514,7 @@ {{/isEnum}} {{#isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache new file mode 100644 index 000000000000..3abce62ff37a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache @@ -0,0 +1,7 @@ +// {{{name}}} ({{{dataType}}}) pattern +Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); +{{#lambda.copy}}this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null && {{/lambda.copy}} +if ({{#lambda.first}}{{^required}}{{#lambda.pasteLine}}{{/lambda.pasteLine}} {{/required}}{{#isNullable}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/isNullable}}{{/lambda.first}}!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{#lambda.first}}{{^required}}! {{/required}}{{#isNullable}}! {{/isNullable}}{{/lambda.first}}{{/isUuid}}).Success) +{ + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 750b196a36cc..1853c889eb1e 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -306,16 +306,24 @@ int hashCode = 41; {{/parent}} {{#readOnlyVars}} + {{#required}} {{^isNullable}} hashCode = (hashCode * 59) + {{name}}.GetHashCode(); {{/isNullable}} + {{/required}} {{/readOnlyVars}} {{#readOnlyVars}} - {{#isNullable}} + {{#lambda.copy}} if ({{name}} != null) hashCode = (hashCode * 59) + {{name}}.GetHashCode(); + {{/lambda.copy}} + {{#isNullable}} + {{#lambda.pasteOnce}}{{/lambda.pasteOnce}} {{/isNullable}} + {{^required}} + {{#lambda.pasteOnce}}{{/lambda.pasteOnce}} + {{/required}} {{/readOnlyVars}} {{#isAdditionalPropertiesTrue}} {{^parentModel}} From 920e3be1a0d9c29f42b7904c28b677ec2f42fd7c Mon Sep 17 00:00:00 2001 From: devhl Date: Wed, 1 Nov 2023 21:38:14 -0400 Subject: [PATCH 14/23] fixed manual tests --- .../libraries/generichost/Option.mustache | 6 + .../UnitTest1.cs | 12 +- .../UnitTest1.cs | 8 +- .../.openapi-generator/FILES | 2 + .../.openapi-generator/VERSION | 2 +- .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 452 ++++ .../UseSourceGeneration/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 2 + .../src/UseSourceGeneration/Client/Option.cs | 12 + .../src/UseSourceGeneration/Model/Activity.cs | 30 +- .../ActivityOutputElementRepresentation.cs | 55 +- .../Model/AdditionalPropertiesClass.cs | 210 +- .../src/UseSourceGeneration/Model/Animal.cs | 47 +- .../UseSourceGeneration/Model/ApiResponse.cs | 75 +- .../src/UseSourceGeneration/Model/Apple.cs | 93 +- .../src/UseSourceGeneration/Model/AppleReq.cs | 44 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 30 +- .../Model/ArrayOfNumberOnly.cs | 30 +- .../UseSourceGeneration/Model/ArrayTest.cs | 82 +- .../src/UseSourceGeneration/Model/Banana.cs | 25 +- .../UseSourceGeneration/Model/BananaReq.cs | 41 +- .../UseSourceGeneration/Model/BasquePig.cs | 20 +- .../Model/Capitalization.cs | 153 +- .../src/UseSourceGeneration/Model/Cat.cs | 57 +- .../src/UseSourceGeneration/Model/Category.cs | 60 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 54 +- .../UseSourceGeneration/Model/ClassModel.cs | 28 +- .../Model/ComplexQuadrilateral.cs | 39 +- .../UseSourceGeneration/Model/DanishPig.cs | 20 +- .../Model/DateOnlyClass.cs | 27 +- .../Model/DeprecatedObject.cs | 28 +- .../src/UseSourceGeneration/Model/Dog.cs | 66 +- .../src/UseSourceGeneration/Model/Drawing.cs | 104 +- .../UseSourceGeneration/Model/EnumArrays.cs | 58 +- .../src/UseSourceGeneration/Model/EnumTest.cs | 544 ++-- .../Model/EquilateralTriangle.cs | 39 +- .../src/UseSourceGeneration/Model/File.cs | 28 +- .../Model/FileSchemaTestClass.cs | 56 +- .../src/UseSourceGeneration/Model/Foo.cs | 28 +- .../Model/FooGetDefaultResponse.cs | 30 +- .../UseSourceGeneration/Model/FormatTest.cs | 559 ++-- .../src/UseSourceGeneration/Model/Fruit.cs | 34 +- .../src/UseSourceGeneration/Model/FruitReq.cs | 4 +- .../src/UseSourceGeneration/Model/GmFruit.cs | 67 +- .../Model/GrandparentAnimal.cs | 20 +- .../Model/HasOnlyReadOnly.cs | 61 +- .../Model/HealthCheckResult.cs | 24 +- .../Model/IsoscelesTriangle.cs | 39 +- .../src/UseSourceGeneration/Model/List.cs | 28 +- .../Model/LiteralStringClass.cs | 53 +- .../src/UseSourceGeneration/Model/Mammal.cs | 24 +- .../src/UseSourceGeneration/Model/MapTest.cs | 111 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 98 +- .../Model/Model200Response.cs | 50 +- .../UseSourceGeneration/Model/ModelClient.cs | 28 +- .../src/UseSourceGeneration/Model/Name.cs | 96 +- ...cationtestGetElementsV1ResponseMPayload.cs | 35 +- .../Model/NullableClass.cs | 298 ++- .../Model/NullableGuidClass.cs | 28 +- .../Model/NullableShape.cs | 22 +- .../UseSourceGeneration/Model/NumberOnly.cs | 25 +- .../Model/ObjectWithDeprecatedFields.cs | 102 +- .../UseSourceGeneration/Model/OneOfString.cs | 4 +- .../src/UseSourceGeneration/Model/Order.cs | 138 +- .../Model/OuterComposite.cs | 72 +- .../UseSourceGeneration/Model/ParentPet.cs | 18 +- .../src/UseSourceGeneration/Model/Pet.cs | 174 +- .../src/UseSourceGeneration/Model/Pig.cs | 22 +- .../Model/PolymorphicProperty.cs | 8 +- .../Model/Quadrilateral.cs | 22 +- .../Model/QuadrilateralInterface.cs | 20 +- .../Model/ReadOnlyFirst.cs | 57 +- .../Model/RequiredClass.cs | 2372 +++++++++++++++++ .../src/UseSourceGeneration/Model/Return.cs | 25 +- .../Model/RolesReportsHash.cs | 51 +- .../Model/RolesReportsHashRole.cs | 28 +- .../Model/ScaleneTriangle.cs | 39 +- .../src/UseSourceGeneration/Model/Shape.cs | 22 +- .../Model/ShapeInterface.cs | 20 +- .../UseSourceGeneration/Model/ShapeOrNull.cs | 22 +- .../Model/SimpleQuadrilateral.cs | 39 +- .../Model/SpecialModelName.cs | 50 +- .../src/UseSourceGeneration/Model/Tag.cs | 50 +- .../Model/TestCollectionEndingWithWordList.cs | 28 +- .../TestCollectionEndingWithWordListObject.cs | 30 +- ...lineFreeformAdditionalPropertiesRequest.cs | 28 +- .../src/UseSourceGeneration/Model/Triangle.cs | 24 +- .../Model/TriangleInterface.cs | 20 +- .../src/UseSourceGeneration/Model/User.cs | 296 +- .../src/UseSourceGeneration/Model/Whale.cs | 66 +- .../src/UseSourceGeneration/Model/Zebra.cs | 48 +- .../Model/ZeroBasedEnumClass.cs | 31 +- 98 files changed, 6784 insertions(+), 1896 deletions(-) create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache index 0283522d76c8..eed49143e41d 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/Option.mustache @@ -37,5 +37,11 @@ namespace {{packageName}}.{{clientPackage}} /// /// public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs index 4e25bc4a95cd..0a0c680ac271 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs @@ -51,7 +51,7 @@ public SerializationTests() [TestMethod] public void Category() { - Category category = new(1, "test"); + Category category = new("test", 1); string categoryJson = JsonSerializer.Serialize(category, _jsonSerializerOptions); Category? category2 = JsonSerializer.Deserialize(categoryJson, _jsonSerializerOptions); Assert.AreEqual(category.Id, category2?.Id); @@ -64,7 +64,7 @@ public void Apple() Apple apple = new("#000000", "cultivar", "origin"); string appleJson = JsonSerializer.Serialize(apple, _jsonSerializerOptions); Apple? apple2 = JsonSerializer.Deserialize(appleJson, _jsonSerializerOptions); - Assert.IsTrue(apple2 != null && apple.Cultivar.Equals(apple2.Cultivar) && apple.Origin.Equals(apple2.Origin)); + Assert.IsTrue(apple2 != null && apple.Cultivar != null && apple.Cultivar.Equals(apple2.Cultivar) && apple.Origin != null && apple.Origin.Equals(apple2.Origin)); } [TestMethod] @@ -106,12 +106,12 @@ public void GmFruit() gmFruit2 != null && gmFruit2.Apple != null && gmFruit2.Banana != null && + gmFruit2.Apple.Cultivar != null && gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && + gmFruit2.Apple.Origin != null && gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); - Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); - Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } @@ -146,7 +146,7 @@ public void ChildCatTest() ChildCat childCat = new("some name", ChildCat.PetTypeEnum.ChildCat); string childCatJson = JsonSerializer.Serialize(childCat, _jsonSerializerOptions); ChildCat? childCat2 = JsonSerializer.Deserialize(childCatJson, _jsonSerializerOptions); - Assert.IsTrue(childCat2 != null && childCat.PetType.Equals(childCat2.PetType) && childCat.Name.Equals(childCat2.Name)); + Assert.IsTrue(childCat2 != null && childCat.PetType.Equals(childCat2.PetType) && childCat.Name != null && childCat.Name.Equals(childCat2.Name)); } [TestMethod] @@ -155,7 +155,7 @@ public void Cat() Cat cat = new("cat", false, "black"); // TODO: where is the address property? string catJson = JsonSerializer.Serialize(cat, _jsonSerializerOptions); Cat? cat2 = JsonSerializer.Deserialize(catJson, _jsonSerializerOptions); - Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color.Equals(cat2.Color)); // TODO: add the address property + Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color != null && cat.Color.Equals(cat2.Color)); // TODO: add the address property } } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs index 1dc4e1bcbd06..a9c8eaf075a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs @@ -50,7 +50,7 @@ public void Apple() Apple apple = new("#000000", "cultivar", "origin"); string appleJson = JsonSerializer.Serialize(apple, _jsonSerializerOptions); Apple? apple2 = JsonSerializer.Deserialize(appleJson, _jsonSerializerOptions); - Assert.IsTrue(apple2 != null && apple.Cultivar.Equals(apple2.Cultivar) && apple.Origin.Equals(apple2.Origin)); + Assert.IsTrue(apple2 != null && apple.Cultivar != null && apple.Cultivar.Equals(apple2.Cultivar) && apple.Origin != null && apple.Origin.Equals(apple2.Origin)); } [TestMethod] @@ -92,12 +92,12 @@ public void GmFruit() gmFruit2 != null && gmFruit2.Apple != null && gmFruit2.Banana != null && + gmFruit2.Apple.Cultivar != null && gmFruit2.Apple.Cultivar.Equals(gmFruit.Apple.Cultivar) && + gmFruit2.Apple.Origin != null && gmFruit2.Apple.Origin.Equals(gmFruit.Apple.Origin) && gmFruit2.Banana.LengthCm.Equals(gmFruit.Banana.LengthCm)); - Apple? apple2 = JsonSerializer.Deserialize(gmFruitJson); - Assert.IsTrue(apple2 != null && apple.Cultivar == apple2.Cultivar && apple.Origin == apple2.Origin); // TODO: assert the the properties from Banana and GmFruit are in additionalProperties } @@ -141,7 +141,7 @@ public void Cat() Cat cat = new("cat", false, "black"); // TODO: where is the address property? string catJson = JsonSerializer.Serialize(cat, _jsonSerializerOptions); Cat? cat2 = JsonSerializer.Deserialize(catJson, _jsonSerializerOptions); - Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color.Equals(cat2.Color)); // TODO: add the address property + Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color != null && cat.Color.Equals(cat2.Color)); // TODO: add the address property } } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES index 03f61d173609..96f2ef1bc1c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/UseSourceGeneration/Model/PolymorphicProperty.cs src/UseSourceGeneration/Model/Quadrilateral.cs src/UseSourceGeneration/Model/QuadrilateralInterface.cs src/UseSourceGeneration/Model/ReadOnlyFirst.cs +src/UseSourceGeneration/Model/RequiredClass.cs src/UseSourceGeneration/Model/Return.cs src/UseSourceGeneration/Model/RolesReportsHash.cs src/UseSourceGeneration/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md index cebefe7ff377..5127709c28f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md index 49836874e08f..f598aab71491 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md index 33be89a5331b..98fa755fce04 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md index 0c5ac31d7992..ea37536068af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md new file mode 100644 index 000000000000..0051888c2aed --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# UseSourceGeneration.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..535d720a770d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using UseSourceGeneration.Model; +using UseSourceGeneration.Client; +using System.Reflection; + +namespace UseSourceGeneration.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs index ed4c7f582c69..f4eb80997ea9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs @@ -143,6 +143,8 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -151,8 +153,6 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -169,6 +169,30 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs index 7a8056ab4da0..a1bc8ed12897 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/HostConfiguration.cs @@ -116,6 +116,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); @@ -210,6 +211,7 @@ public HostConfiguration(IServiceCollection services) new QuadrilateralSerializationContext(), new QuadrilateralInterfaceSerializationContext(), new ReadOnlyFirstSerializationContext(), + new RequiredClassSerializationContext(), new ReturnSerializationContext(), new RolesReportsHashSerializationContext(), new RolesReportsHashRoleSerializationContext(), diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs index 93f54baec74c..2c6fe01fa6e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index 21b946eba142..18c297abdd6d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -37,19 +37,25 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>?> activityOutputs = default) { - ActivityOutputs = activityOutputs; + ActivityOutputsOption = activityOutputs; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + public Option>?> ActivityOutputsOption { get; private set; } // option d + /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary>? activityOutputs = default; + Option>?> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +137,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + return new Activity(activityOutputs); // a } /// @@ -161,8 +167,12 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) // 14 + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index 7d7042c48e51..cfd5a73d393e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -38,26 +38,38 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { - Prop1 = prop1; - Prop2 = prop2; + Prop1Option = prop1; + Prop2Option = prop2; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + public Option Prop1Option { get; private set; } // option d + /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + public Option Prop2Option { get; private set; } // option d /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? prop1 = default; - Object? prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -132,11 +144,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -144,13 +156,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + return new ActivityOutputElementRepresentation(prop1, prop2); // a } /// @@ -177,9 +189,18 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + + if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index 09b3dd1d2611..85cb4d22d57b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -44,69 +44,117 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { - EmptyMap = emptyMap; - MapOfMapProperty = mapOfMapProperty; - MapProperty = mapProperty; - MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; - MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; - MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; - MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; - Anytype1 = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + Anytype1Option = anytype1; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + public Option EmptyMapOption { get; private set; } // option d + /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + public Option>?> MapOfMapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + public Option?> MapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + public Option Anytype1Option { get; private set; } // option d /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get; set; } + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -168,14 +216,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object? emptyMap = default; - Dictionary>? mapOfMapProperty = default; - Dictionary? mapProperty = default; - Object? mapWithUndeclaredPropertiesAnytype1 = default; - Object? mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary? mapWithUndeclaredPropertiesString = default; - Object? anytype1 = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -194,35 +242,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -230,28 +278,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a } /// @@ -278,22 +326,56 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index 6beaaf3e97ce..fd9ab8f8951f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -38,10 +38,10 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; - Color = color; + ColorOption = color; OnCreated(); } @@ -51,13 +51,19 @@ public Animal(string className, string color = @"red") /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -123,8 +129,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - string? color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -142,10 +148,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -153,13 +159,16 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className, color); + return new Animal(className.Value!, color); // a } /// @@ -186,8 +195,16 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); // 1 + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index 44f22494b301..4882c7a0c88a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -39,33 +39,51 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { - Code = code; - Message = message; - Type = type; + CodeOption = code; + MessageOption = message; + TypeOption = type; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Code + /// + [JsonIgnore] + public Option CodeOption { get; private set; } // option d + /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + public Option MessageOption { get; private set; } // option d /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option d /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -122,9 +140,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string? message = default; - string? type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -143,13 +161,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()!); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -157,16 +175,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + return new ApiResponse(code, message, type); // a } /// @@ -193,9 +211,20 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); // 1 + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index f163ab1d0ba5..e0f3322620b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -39,33 +39,51 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { - ColorCode = colorCode; - Cultivar = cultivar; - Origin = origin; + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + public Option ColorCodeOption { get; private set; } // option d + /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + public Option CultivarOption { get; private set; } // option d /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + public Option OriginOption { get; private set; } // option d /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -96,28 +114,31 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCodeOption.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.CultivarOption.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.OriginOption.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -149,9 +170,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? colorCode = default; - string? cultivar = default; - string? origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -169,13 +190,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()!); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -183,16 +204,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + return new Apple(colorCode, cultivar, origin); // a } /// @@ -219,9 +240,23 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); // 1 + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); // 1 + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index 52d9af2f3611..2896370f2d2d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -38,10 +38,10 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; - Mealy = mealy; + MealyOption = mealy; OnCreated(); } @@ -51,13 +51,19 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get; set; } // d + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + public Option MealyOption { get; private set; } // option d /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -106,8 +112,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -125,11 +131,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -137,13 +143,16 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value!, mealy); // a } /// @@ -170,8 +179,13 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); // 1 + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index 96905a9ad00d..2295508e2437 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -37,19 +37,25 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = default) { - ArrayArrayNumber = arrayArrayNumber; + ArrayArrayNumberOption = arrayArrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + public Option>?> ArrayArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayNumber = default; + Option>?> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +137,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a } /// @@ -161,8 +167,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 2fc3f9aa15b3..5be3d1702d71 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -37,19 +37,25 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option?> arrayNumber = default) { - ArrayNumber = arrayNumber; + ArrayNumberOption = arrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + public Option?> ArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayNumber = default; + Option?> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +137,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + return new ArrayOfNumberOnly(arrayNumber); // a } /// @@ -161,8 +167,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 5923398e2cac..735e45a1a769 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -39,33 +39,51 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>?> arrayArrayOfInteger = default, Option>?> arrayArrayOfModel = default, Option?> arrayOfString = default) { - ArrayArrayOfInteger = arrayArrayOfInteger; - ArrayArrayOfModel = arrayArrayOfModel; - ArrayOfString = arrayOfString; + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + public Option>?> ArrayArrayOfIntegerOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + public Option>?> ArrayArrayOfModelOption { get; private set; } // option d /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + public Option?> ArrayOfStringOption { get; private set; } // option d /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -122,9 +140,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayOfInteger = default; - List>? arrayArrayOfModel = default; - List? arrayOfString = default; + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -143,15 +161,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -159,16 +177,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a } /// @@ -195,12 +213,24 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs index 5528e531ea89..03e94b048c72 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs @@ -37,19 +37,25 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { - LengthCm = lengthCm; + LengthCmOption = lengthCm; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + public Option LengthCmOption { get; private set; } // option d + /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -131,10 +137,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + return new Banana(lengthCm); // a } /// @@ -161,7 +167,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index 7b5186114050..5f55a0f1f59b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -38,10 +38,10 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; - Sweet = sweet; + SweetOption = sweet; OnCreated(); } @@ -51,13 +51,19 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal LengthCm { get; set; } // d + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + public Option SweetOption { get; private set; } // option d /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -106,8 +112,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -126,11 +132,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -138,13 +144,16 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value!.Value!, sweet); // a } /// @@ -171,8 +180,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs index 4721383c8969..3f96b5db6715 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs @@ -49,7 +49,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,13 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); - return new BasquePig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value!); // a } /// @@ -160,7 +163,10 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", basquePig.ClassName); + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index b0cc3ec0d597..d3c940c19591 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -42,55 +42,91 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { - ATT_NAME = aTTNAME; - CapitalCamel = capitalCamel; - CapitalSnake = capitalSnake; - SCAETHFlowPoints = sCAETHFlowPoints; - SmallCamel = smallCamel; - SmallSnake = smallSnake; + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + public Option ATT_NAMEOption { get; private set; } // option d + /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + public Option CapitalCamelOption { get; private set; } // option d /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + public Option CapitalSnakeOption { get; private set; } // option d /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + public Option SCAETHFlowPointsOption { get; private set; } // option d /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + public Option SmallCamelOption { get; private set; } // option d /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + public Option SmallSnakeOption { get; private set; } // option d /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -150,12 +186,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? aTTNAME = default; - string? capitalCamel = default; - string? capitalSnake = default; - string? sCAETHFlowPoints = default; - string? smallCamel = default; - string? smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -173,22 +209,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()!); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()!); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()!); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()!); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,25 +232,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a } /// @@ -241,12 +277,41 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index 9535772c5069..5e477baaeeac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -39,19 +39,25 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { - Declawed = declawed; + DeclawedOption = declawed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + public Option DeclawedOption { get; private set; } // option d + /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -90,9 +96,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? declawed = default; - string? color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -110,14 +116,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -125,16 +131,19 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + return new Cat(className.Value!, declawed, color); // a } /// @@ -161,9 +170,19 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); // 1 + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 1c1133055c7c..e330646b2b6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -35,29 +35,35 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + IdOption = id; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } // d /// - /// Gets or Sets Name + /// Used to track the state of Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -73,8 +79,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -113,8 +119,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -131,12 +137,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -144,13 +150,16 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(id.Value, name); + return new Category(name.Value!, id); // a } /// @@ -177,8 +186,13 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + writer.WriteString("name", category.Name); // 1 + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index 7a1c4d8042d5..e9c49bb68d44 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -38,10 +38,10 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { - Name = name; - PetType = petType; + NameOption = name; + PetTypeOption = petType; OnCreated(); } @@ -91,26 +91,37 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// /// /// - public static string PetTypeEnumToJsonValue(PetTypeEnum value) + public static string PetTypeEnumToJsonValue(PetTypeEnum? value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of PetType + /// + [JsonIgnore] + public new Option PetTypeOption { get; private set; } // option a + /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -150,8 +161,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -169,13 +180,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -183,13 +193,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + return new ChildCat(name, petType); // a } /// @@ -216,9 +226,13 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); // 1 - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index af9e0c3d1c52..6d5349408bc3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -37,19 +37,25 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { - VarClass = varClass; + VarClassOption = varClass; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + return new ClassModel(varClass); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClassOption.IsSet && classModel.VarClass == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + + if (classModel.VarClassOption.IsSet) + writer.WriteString("_class", classModel.VarClass); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index 3d57316efa89..924c05c48b31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -51,13 +51,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,19 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -176,8 +182,15 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs index 8734f04bad7e..e24a2a132925 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs @@ -49,7 +49,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,13 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); - return new DanishPig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value!); // a } /// @@ -160,7 +163,10 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", danishPig.ClassName); + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index bd4801d771cb..eeacc8a0dcaf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -37,20 +37,26 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { - DateOnlyProperty = dateOnlyProperty; + DateOnlyPropertyOption = dateOnlyProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + public Option DateOnlyPropertyOption { get; private set; } // option d + /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -110,7 +116,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +135,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -137,10 +143,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + return new DateOnlyClass(dateOnlyProperty); // a } /// @@ -167,7 +173,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index 1783c3add71c..26e52607c32e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -37,19 +37,25 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + return new DeprecatedObject(name); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index 70beb60686ba..3b14f4f5a578 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -35,23 +35,29 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { - Breed = breed; + BreedOption = breed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + public Option BreedOption { get; private set; } // option d + /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -90,9 +96,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? breed = default; - string? className = default; - string? color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -109,14 +115,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -124,16 +130,19 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(breed, className, color); + return new Dog(className.Value!, breed, color); // a } /// @@ -160,9 +169,22 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); // 1 + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); // 1 + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index 955f0571e1d9..ce32e69af682 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -40,40 +40,64 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option?> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { - MainShape = mainShape; - Shapes = shapes; - NullableShape = nullableShape; - ShapeOrNull = shapeOrNull; + MainShapeOption = mainShape; + ShapesOption = shapes; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + public Option MainShapeOption { get; private set; } // option d + /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + public Option?> ShapesOption { get; private set; } // option d /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + public Option NullableShapeOption { get; private set; } // option d /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get; set; } + public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + public Option ShapeOrNullOption { get; private set; } // option d /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get; set; } + public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -142,10 +166,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape? mainShape = default; - List? shapes = default; - NullableShape? nullableShape = default; - ShapeOrNull? shapeOrNull = default; + Option mainShape = default; + Option?> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -164,19 +188,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -184,13 +208,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a } /// @@ -217,14 +241,34 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) // 14 + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.ShapesOption.IsSet) // 14 + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index d6194ce8255f..a911172aa949 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -38,10 +38,10 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default) { - ArrayEnum = arrayEnum; - JustSymbol = justSymbol; + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; OnCreated(); } @@ -102,9 +102,8 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// /// /// - public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) + public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -169,9 +168,8 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// /// /// - public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -181,17 +179,29 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + public Option JustSymbolOption { get; private set; } // option a + /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + public Option?> ArrayEnumOption { get; private set; } // option d /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -247,8 +257,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option?> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -267,13 +277,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -281,13 +290,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + return new EnumArrays(arrayEnum, justSymbol); // a } /// @@ -314,10 +323,13 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnumOption.IsSet) // 14 + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index c267bb49c12e..15fe3d73899c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -35,32 +35,188 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { - EnumInteger = enumInteger; - EnumIntegerOnly = enumIntegerOnly; - EnumNumber = enumNumber; - EnumString = enumString; EnumStringRequired = enumStringRequired; - OuterEnumDefaultValue = outerEnumDefaultValue; - OuterEnumInteger = outerEnumInteger; - OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; - OuterEnum = outerEnum; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OuterEnumOption = outerEnum; OnCreated(); } partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + /// /// Defines EnumInteger /// @@ -120,11 +276,17 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) return (int) value; } + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + public Option EnumIntegerOption { get; private set; } // option a + /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a /// /// Defines EnumIntegerOnly @@ -185,11 +347,17 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) return (int) value; } + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + public Option EnumIntegerOnlyOption { get; private set; } // option a + /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a /// /// Defines EnumNumber @@ -246,9 +414,8 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// /// /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) { - if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -258,11 +425,17 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + public Option EnumNumberOption { get; private set; } // option a + /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a /// /// Defines EnumString @@ -385,9 +558,8 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// /// /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) { - if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -416,191 +588,64 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) } /// - /// Gets or Sets EnumString + /// Used to track the state of EnumString /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + [JsonIgnore] + public Option EnumStringOption { get; private set; } // option a /// - /// Defines EnumStringRequired + /// Gets or Sets EnumString /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a /// - /// Returns a + /// Used to track the state of OuterEnumDefaultValue /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumDefaultValueOption { get; private set; } // option a /// - /// Returns a + /// Gets or Sets OuterEnumDefaultValue /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a /// - /// Converts the to the json value + /// Used to track the state of OuterEnumInteger /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumIntegerOption { get; private set; } // option a /// - /// Gets or Sets EnumStringRequired + /// Gets or Sets OuterEnumInteger /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a /// - /// Gets or Sets OuterEnumDefaultValue + /// Used to track the state of OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a /// - /// Gets or Sets OuterEnumInteger + /// Gets or Sets OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a /// - /// Gets or Sets OuterEnumIntegerDefaultValue + /// Used to track the state of OuterEnum /// - [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumOption { get; private set; } // option a /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -616,11 +661,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -663,15 +708,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -688,53 +733,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -742,31 +781,34 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a } /// @@ -793,44 +835,50 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - else - writer.WriteNull("outerEnumDefaultValue"); + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else + writer.WriteNull("enum_string"); + + if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) // 10 { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnumOption.IsSet) // 10 + if (enumTest.OuterEnumOption!.Value != null) // 10 a + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index b161cd58e182..35a60c1e8316 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -51,13 +51,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,19 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -176,8 +182,15 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index bc7f05fae9e0..20c7fdfb332e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -37,20 +37,26 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { - SourceURI = sourceURI; + SourceURIOption = sourceURI; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + public Option SourceURIOption { get; private set; } // option d + /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -105,7 +111,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -131,10 +137,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + return new File(sourceURI); // a } /// @@ -161,7 +167,11 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index 68d2af61dbc1..930cbfa306e6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -38,26 +38,38 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option?> files = default) { - File = file; - Files = files; + FileOption = file; + FilesOption = files; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of File + /// + [JsonIgnore] + public Option FileOption { get; private set; } // option d + /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + public Option?> FilesOption { get; private set; } // option d /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File? file = default; - List? files = default; + Option file = default; + Option?> files = default; while (utf8JsonReader.Read()) { @@ -133,11 +145,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -145,13 +157,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + return new FileSchemaTestClass(file, files); // a } /// @@ -178,10 +190,18 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) // 14 + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.FilesOption.IsSet) // 14 + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index dbedd34f861d..01cf7952b547 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -37,19 +37,25 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { - Bar = bar; + BarOption = bar; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; private set; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + return new Foo(bar); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index dabc1bd83dbf..5b58204da9f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -37,19 +37,25 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { - VarString = varString; + VarStringOption = varString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d + /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo? varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +137,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + return new FooGetDefaultResponse(varString); // a } /// @@ -161,8 +167,12 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index d45a83b0f1d7..2aaa7c07ca64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -35,9 +35,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -45,8 +47,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -55,151 +55,241 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; - DateTime = dateTime; - VarDecimal = varDecimal; - VarDouble = varDouble; - VarFloat = varFloat; - Int32 = int32; - Int64 = int64; - Integer = integer; Number = number; Password = password; - PatternWithBackslash = patternWithBackslash; - PatternWithDigits = patternWithDigits; - PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; - VarString = varString; - UnsignedInteger = unsignedInteger; - UnsignedLong = unsignedLong; - Uuid = uuid; + BinaryOption = binary; + DateTimeOption = dateTime; + VarDecimalOption = varDecimal; + VarDoubleOption = varDouble; + VarFloatOption = varFloat; + Int32Option = int32; + Int64Option = int64; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + VarStringOption = varString; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } + public byte[] VarByte { get; set; } // d /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } + public DateTime Date { get; set; } // d + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } // d + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } // d + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + public Option BinaryOption { get; private set; } // option d + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of VarDecimal + /// + [JsonIgnore] + public Option VarDecimalOption { get; private set; } // option d /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + + /// + /// Used to track the state of VarDouble + /// + [JsonIgnore] + public Option VarDoubleOption { get; private set; } // option d /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + + /// + /// Used to track the state of VarFloat + /// + [JsonIgnore] + public Option VarFloatOption { get; private set; } // option d /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + public Option Int32Option { get; private set; } // option d /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + public Option Int64Option { get; private set; } // option d /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d /// - /// Gets or Sets Integer + /// Used to track the state of Integer /// - [JsonPropertyName("integer")] - public int Integer { get; set; } + [JsonIgnore] + public Option IntegerOption { get; private set; } // option d /// - /// Gets or Sets Number + /// Gets or Sets Integer /// - [JsonPropertyName("number")] - public decimal Number { get; set; } + [JsonPropertyName("integer")] + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d /// - /// Gets or Sets Password + /// Used to track the state of PatternWithBackslash /// - [JsonPropertyName("password")] - public string Password { get; set; } + [JsonIgnore] + public Option PatternWithBackslashOption { get; private set; } // option d /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + public Option PatternWithDigitsOption { get; private set; } // option d /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + public Option UnsignedIntegerOption { get; private set; } // option d /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + public Option UnsignedLongOption { get; private set; } // option d /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -215,9 +305,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -225,8 +317,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -246,122 +336,126 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslashOption.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigitsOption.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarStringOption.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + + if (this.VarStringOption.Value != null &&!regexVarString.Match(this.VarStringOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -402,25 +496,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream? binary = default; - byte[]? varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string? password = default; - string? patternWithBackslash = default; - string? patternWithDigits = default; - string? patternWithDigitsAndDelimiter = default; - string? varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -437,76 +531,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -514,64 +608,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - if (varByte == null) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - if (date == null) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a } /// @@ -598,28 +704,79 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarStringOption.IsSet && formatTest.VarString == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + + writer.WriteNumber("number", formatTest.Number); // 3 + + writer.WriteString("password", formatTest.Password); // 1 + + if (formatTest.BinaryOption.IsSet) // 14 + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (formatTest.VarDecimalOption.IsSet) // 14 + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDoubleOption.IsSet) + writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + + if (formatTest.VarFloatOption.IsSet) + writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + + if (formatTest.VarStringOption.IsSet) + writer.WriteString("string", formatTest.VarString); // 1 + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index be945563eba9..e62a3ac5f327 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -37,10 +37,10 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; - Color = color; + ColorOption = color; OnCreated(); } @@ -49,10 +49,10 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; - Color = color; + ColorOption = color; OnCreated(); } @@ -68,11 +68,17 @@ public Fruit(Banana banana, string color) /// public Banana? Banana { get; set; } + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d + /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -120,7 +126,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -160,7 +166,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -168,14 +174,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, color); // b if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, color); // b throw new JsonException(); } @@ -204,7 +210,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs index 797f263735e0..d135e0fd2550 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs @@ -153,10 +153,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); + return new FruitReq(appleReq); // b if (bananaReq != null) - return new FruitReq(bananaReq); + return new FruitReq(bananaReq); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index fea0b966137f..d3252c6ce581 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -38,31 +38,49 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple? apple, Banana? banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { - Apple = apple; - Banana = banana; - Color = color; + AppleOption = apple; + BananaOption = banana; + ColorOption = color; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + public Option AppleOption { get; private set; } // option b + /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + public Option BananaOption { get; private set; } // option b /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -110,7 +128,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -150,7 +168,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -158,10 +176,17 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); // a } /// @@ -175,16 +200,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.AppleOption.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.BananaOption.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -200,7 +225,11 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs index d4a0752699b2..c7c370ed3723 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs @@ -49,7 +49,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } + public string PetType { get; set; } // d /// /// Gets or Sets additional properties @@ -114,7 +114,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -132,7 +132,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -140,10 +140,13 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); - return new GrandparentAnimal(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(petType.Value!); // a } /// @@ -170,7 +173,10 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", grandparentAnimal.PetType); + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + + writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index 0ba58633d833..ff771e015451 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -38,26 +38,38 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { - Bar = bar; - Foo = foo; + BarOption = bar; + FooOption = foo; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string? Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + public Option FooOption { get; } // option d /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public string? Foo { get { return this. FooOption; } } // d /// /// Gets or Sets additional properties @@ -109,8 +121,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); - hashCode = (hashCode * 59) + Foo.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -150,8 +166,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -169,10 +185,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -180,13 +196,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + return new HasOnlyReadOnly(bar, foo); // a } /// @@ -213,8 +229,17 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs index b0753cea2a42..e529ef10adbb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs @@ -37,19 +37,25 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string? nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { - NullableMessage = nullableMessage; + NullableMessageOption = nullableMessage; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + public Option NullableMessageOption { get; private set; } // option d + /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get; set; } + public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -130,7 +136,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); + return new HealthCheckResult(nullableMessage); // a } /// @@ -157,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + else + writer.WriteNull("NullableMessage"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index e54fa76f0663..47ceb71759ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -51,13 +51,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Returns the string presentation of the object @@ -106,8 +106,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -125,10 +125,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -136,13 +136,19 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -169,8 +175,15 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index 031e16c39a57..2883d97e3d68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -37,19 +37,25 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { - Var123List = var123List; + Var123ListOption = var123List; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + public Option Var123ListOption { get; private set; } // option d + /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + return new List(var123List); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 46ae1dc05ae3..941b4192f597 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -38,26 +38,38 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { - EscapedLiteralString = escapedLiteralString; - UnescapedLiteralString = unescapedLiteralString; + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + public Option EscapedLiteralStringOption { get; private set; } // option d + /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + public Option UnescapedLiteralStringOption { get; private set; } // option d /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? escapedLiteralString = default; - string? unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -132,10 +144,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()!); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +155,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a } /// @@ -176,8 +188,17 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs index fcc1424f2c19..ce4d38c3e0f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs @@ -89,7 +89,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; Pig? pig = null; Whale? whale = null; @@ -211,7 +211,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -219,17 +219,20 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, className.Value!); // c if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, className.Value!); // c if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, className.Value!); // c throw new JsonException(); } @@ -273,7 +276,10 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", mammal.ClassName); + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + + writer.WriteString("className", mammal.ClassName); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index e3deeb54016f..c8df4fb85b54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -40,12 +40,12 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option?> directMap = default, Option?> indirectMap = default, Option>?> mapMapOfString = default, Option?> mapOfEnumString = default) { - DirectMap = directMap; - IndirectMap = indirectMap; - MapMapOfString = mapMapOfString; - MapOfEnumString = mapOfEnumString; + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; OnCreated(); } @@ -106,9 +106,8 @@ public static InnerEnum InnerEnumFromString(string value) /// /// /// - public static string InnerEnumToJsonValue(InnerEnum value) + public static string InnerEnumToJsonValue(InnerEnum? value) { - if (value == InnerEnum.UPPER) return "UPPER"; @@ -118,29 +117,53 @@ public static string InnerEnumToJsonValue(InnerEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + public Option?> DirectMapOption { get; private set; } // option d + /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + public Option?> IndirectMapOption { get; private set; } // option d /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + public Option>?> MapMapOfStringOption { get; private set; } // option d /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + public Option?> MapOfEnumStringOption { get; private set; } // option d /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -198,10 +221,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary? directMap = default; - Dictionary? indirectMap = default; - Dictionary>? mapMapOfString = default; - Dictionary? mapOfEnumString = default; + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -220,19 +243,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -240,19 +263,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a } /// @@ -279,14 +302,30 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) // 14 + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMapOption.IsSet) // 14 + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfStringOption.IsSet) // 14 + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumStringOption.IsSet) // 14 + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 25ea1076cd59..fa5b73120769 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -40,40 +40,64 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option?> map = default, Option uuid = default, Option uuidWithPattern = default) { - DateTime = dateTime; - Map = map; - Uuid = uuid; - UuidWithPattern = uuidWithPattern; + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d + /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + public Option?> MapOption { get; private set; } // option d /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + public Option UuidWithPatternOption { get; private set; } // option d /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -107,7 +131,8 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -142,10 +167,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary? map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -164,19 +189,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -184,19 +209,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a } /// @@ -223,11 +248,20 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index 74f7acb1e828..301f26d8bfcd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -38,26 +38,38 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { - VarClass = varClass; - Name = name; + VarClassOption = varClass; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -132,11 +144,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -144,13 +156,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + return new Model200Response(varClass, name); // a } /// @@ -177,8 +189,14 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClassOption.IsSet && model200Response.VarClass == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + + if (model200Response.VarClassOption.IsSet) + writer.WriteString("class", model200Response.VarClass); // 1 + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index 5bc60589f350..6dcf22a39ed3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -37,19 +37,25 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { - VarClient = varClient; + VarClientOption = varClient; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + public Option VarClientOption { get; private set; } // option d + /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + return new ModelClient(varClient); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 4648cf04f7d2..b90ab689c17d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -40,12 +40,12 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; - Property = property; - SnakeCase = snakeCase; - Var123Number = var123Number; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; OnCreated(); } @@ -55,25 +55,43 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } + public int VarName { get; set; } // d + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + public Option PropertyOption { get; private set; } // option d /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + public Option SnakeCaseOption { get; } // option d /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + public Option Var123NumberOption { get; } // option d /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public int? Var123Number { get { return this. Var123NumberOption; } } // d /// /// Gets or Sets additional properties @@ -127,8 +145,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); - hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -168,10 +190,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string? property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -190,18 +212,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -209,19 +231,22 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a } /// @@ -248,10 +273,19 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); // 3 + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); // 1 + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs index ed43ab9fcd27..de0fb2e22484 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -51,13 +51,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } + public List> AObjVariableobject { get; set; } // d /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } + public int PkiNotificationtestID { get; set; } // d /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -133,11 +133,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -145,13 +145,19 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); - if (pkiNotificationtestID == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a } /// @@ -178,9 +184,12 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 5374e7a890e8..7c44215def97 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -48,96 +48,168 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() + public NullableClass(Option?> arrayItemsNullable = default, Option?> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullable = arrayItemsNullable; - ObjectItemsNullable = objectItemsNullable; - ArrayAndItemsNullableProp = arrayAndItemsNullableProp; - ArrayNullableProp = arrayNullableProp; - BooleanProp = booleanProp; - DateProp = dateProp; - DatetimeProp = datetimeProp; - IntegerProp = integerProp; - NumberProp = numberProp; - ObjectAndItemsNullableProp = objectAndItemsNullableProp; - ObjectNullableProp = objectNullableProp; - StringProp = stringProp; + ArrayItemsNullableOption = arrayItemsNullable; + ObjectItemsNullableOption = objectItemsNullable; + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + public Option?> ArrayItemsNullableOption { get; private set; } // option d + /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + public Option?> ObjectItemsNullableOption { get; private set; } // option d /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + public Option?> ArrayAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get; set; } + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + public Option?> ArrayNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get; set; } + public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + public Option BooleanPropOption { get; private set; } // option d /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + public Option DatePropOption { get; private set; } // option d /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + public Option DatetimePropOption { get; private set; } // option d /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + public Option IntegerPropOption { get; private set; } // option d /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + public Option NumberPropOption { get; private set; } // option d /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + public Option?> ObjectAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get; set; } + public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + public Option?> ObjectNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get; set; } + public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + public Option StringPropOption { get; private set; } // option d /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get; set; } + public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -224,18 +296,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayItemsNullable = default; - Dictionary? objectItemsNullable = default; - List? arrayAndItemsNullableProp = default; - List? arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary? objectAndItemsNullableProp = default; - Dictionary? objectNullableProp = default; - string? stringProp = default; + Option?> arrayItemsNullable = default; + Option?> objectItemsNullable = default; + Option?> arrayAndItemsNullableProp = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -254,50 +326,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -305,13 +377,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a } /// @@ -338,45 +410,85 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); // 1 + else + writer.WriteNull("string_prop"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs index eb5434dc5ba1..04c4783d6e5f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs @@ -37,20 +37,26 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { - Uuid = uuid; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d + /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -105,7 +111,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -124,7 +130,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -132,7 +138,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); + return new NullableGuidClass(uuid); // a } /// @@ -159,11 +165,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + else + writer.WriteNull("uuid"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs index 8a1f0995af65..e9701f89978b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs @@ -72,7 +72,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,17 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -242,7 +245,10 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", nullableShape.ShapeType); + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + + writer.WriteString("shapeType", nullableShape.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs index 740f496eb9d7..047a1ae9425a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs @@ -37,19 +37,25 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { - JustNumber = justNumber; + JustNumberOption = justNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + public Option JustNumberOption { get; private set; } // option d + /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -131,10 +137,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + return new NumberOnly(justNumber); // a } /// @@ -161,7 +167,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index 729b057bdb4e..b5acb1810597 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -40,43 +40,67 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option?> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { - Bars = bars; - DeprecatedRef = deprecatedRef; - Id = id; - Uuid = uuid; + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + public Option?> BarsOption { get; private set; } // option d + /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + public Option DeprecatedRefOption { get; private set; } // option d /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -134,10 +158,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? bars = default; - DeprecatedObject? deprecatedRef = default; - decimal? id = default; - string? uuid = default; + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -156,18 +180,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -175,19 +199,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a } /// @@ -214,12 +238,26 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs index e2c6672e77d8..8f160a2336e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs @@ -125,10 +125,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index 5283e0ae275d..c9d085afafe1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -42,14 +42,14 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { - Id = id; - PetId = petId; - Quantity = quantity; - ShipDate = shipDate; - Status = status; - Complete = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + CompleteOption = complete; OnCreated(); } @@ -122,9 +122,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Placed) return "placed"; @@ -137,43 +136,79 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + public Option PetIdOption { get; private set; } // option d /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + public Option QuantityOption { get; private set; } // option d /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + public Option ShipDateOption { get; private set; } // option d /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + public Option CompleteOption { get; private set; } // option d /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -238,12 +273,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -262,29 +297,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -292,25 +326,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + return new Order(id, petId, quantity, shipDate, status, complete); // a } /// @@ -337,18 +371,26 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index 87526afade06..75d24a0d94e7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -39,33 +39,51 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { - MyBoolean = myBoolean; - MyNumber = myNumber; - MyString = myString; + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + public Option MyBooleanOption { get; private set; } // option d + /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + public Option MyNumberOption { get; private set; } // option d /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + public Option MyStringOption { get; private set; } // option d /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -122,9 +140,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string? myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -143,14 +161,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -158,16 +176,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + return new OuterComposite(myBoolean, myNumber, myString); // a } /// @@ -194,9 +212,17 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs index 1162f9a2a32d..b0e91e45054e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs @@ -80,7 +80,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -98,7 +98,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -106,10 +106,13 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); - return new ParentPet(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(petType.Value!); // a } /// @@ -136,7 +139,10 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", parentPet.PetType); + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + + writer.WriteString("pet_type", parentPet.PetType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index 8b15e328ca81..42ab00563e62 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -35,21 +35,21 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option?> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; - Status = status; - Tags = tags; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; OnCreated(); } @@ -122,9 +122,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Available) return "available"; @@ -137,43 +136,67 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Gets or Sets Name + /// + /// doggie + [JsonPropertyName("name")] + public string Name { get; set; } // d + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } // d + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + public Option CategoryOption { get; private set; } // option d /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get; set; } + public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d /// - /// Gets or Sets Id + /// Used to track the state of Id /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// - /// Gets or Sets Name + /// Gets or Sets Id /// - /// doggie - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// - /// Gets or Sets PhotoUrls + /// Used to track the state of Tags /// - [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } + [JsonIgnore] + public Option?> TagsOption { get; private set; } // option d /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -189,10 +212,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -233,12 +256,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category? category = default; - long? id = default; - string? name = default; - List? photoUrls = default; - Pet.StatusEnum? status = default; - List? tags = default; + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; while (utf8JsonReader.Read()) { @@ -255,30 +278,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()!); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -286,25 +308,31 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); - if (photoUrls == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a } /// @@ -331,21 +359,37 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); // 1 + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 + if (pet.CategoryOption.IsSet) // 14 + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.TagsOption.IsSet) // 14 + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs index 3f9fdf20cd85..12666be9c575 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs @@ -72,7 +72,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -188,7 +188,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,17 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, className.Value!); // c if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, className.Value!); // c throw new JsonException(); } @@ -242,7 +245,10 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", pig.ClassName); + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + + writer.WriteString("className", pig.ClassName); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs index 5eb22871d845..d278b8d7b526 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs @@ -198,16 +198,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); + return new PolymorphicProperty(varBool); // b if (varString != null) - return new PolymorphicProperty(varString); + return new PolymorphicProperty(varString); // b if (varObject != null) - return new PolymorphicProperty(varObject); + return new PolymorphicProperty(varObject); // b if (list != null) - return new PolymorphicProperty(list); + return new PolymorphicProperty(list); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs index 8b6c244ab73d..3ab95445465e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs @@ -72,7 +72,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -188,7 +188,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,17 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c throw new JsonException(); } @@ -242,7 +245,10 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs index 91f6a55eb207..7cf9be9e32ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs @@ -49,7 +49,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,13 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value!); // a } /// @@ -160,7 +163,10 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index 5ecf54003200..f7130d58f4ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -38,26 +38,38 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { - Bar = bar; - Baz = baz; + BarOption = bar; + BazOption = baz; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string? Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + public Option BazOption { get; private set; } // option d /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,7 +121,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -149,8 +163,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -168,10 +182,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -179,13 +193,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + return new ReadOnlyFirst(bar, baz); // a } /// @@ -212,8 +226,17 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); // 1 + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs new file mode 100644 index 000000000000..957bd4048032 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -0,0 +1,2372 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = UseSourceGeneration.Client.ClientUtils; +using System.Text.Json.Serialization.Metadata; +using UseSourceGeneration.Client; + +namespace UseSourceGeneration.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } // d + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } // d + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + public Option NotrequiredNullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + + if (requiredClass.RequiredNullableArrayOfString != null) // 12 + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + else + writer.WriteNull("required_nullable_uuid"); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } + + /// + /// The RequiredClassSerializationContext + /// + [JsonSourceGenerationOptions(WriteIndented = true, GenerationMode = JsonSourceGenerationMode.Metadata | JsonSourceGenerationMode.Serialization)] + [JsonSerializable(typeof(RequiredClass))] + public partial class RequiredClassSerializationContext : JsonSerializerContext { } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs index 454e16dd0f52..b2f420aca31d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs @@ -37,19 +37,25 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { - VarReturn = varReturn; + VarReturnOption = varReturn; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + public Option VarReturnOption { get; private set; } // option d + /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -131,10 +137,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + return new Return(varReturn); // a } /// @@ -161,7 +167,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index 3485ce95577c..bbf5b551c2bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -38,26 +38,38 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { - Role = role; - RoleUuid = roleUuid; + RoleOption = role; + RoleUuidOption = roleUuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Role + /// + [JsonIgnore] + public Option RoleOption { get; private set; } // option d + /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + public Option RoleUuidOption { get; private set; } // option d /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole? role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -133,11 +145,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -145,13 +157,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + return new RolesReportsHash(role, roleUuid); // a } /// @@ -178,9 +190,14 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) // 14 + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 9c20ab46bad7..71951eece545 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -37,19 +37,25 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + return new RolesReportsHashRole(name); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index 39f7d8cc72f2..c13400169067 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -51,13 +51,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,19 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -176,8 +182,15 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs index 7100b878d3bd..e10c3c177dc3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs @@ -72,7 +72,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,17 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -242,7 +245,10 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shape.ShapeType); + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + + writer.WriteString("shapeType", shape.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs index 0a994154af08..81906ab67c51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs @@ -49,7 +49,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,13 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); - return new ShapeInterface(shapeType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value!); // a } /// @@ -160,7 +163,10 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeInterface.ShapeType); + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs index c0b313a2f362..a55562533625 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs @@ -72,7 +72,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -188,7 +188,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -196,14 +196,17 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -242,7 +245,10 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeOrNull.ShapeType); + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + + writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index c41dcdc9dcf6..1fb9bb58dc43 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -51,13 +51,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -113,8 +113,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -132,10 +132,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -143,13 +143,19 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -176,8 +182,15 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 06b9d48e4696..c73356705c49 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -38,26 +38,38 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { - VarSpecialModelName = varSpecialModelName; - SpecialPropertyName = specialPropertyName; + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + public Option VarSpecialModelNameOption { get; private set; } // option d + /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + public Option SpecialPropertyNameOption { get; private set; } // option d /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -132,11 +144,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -144,13 +156,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + return new SpecialModelName(varSpecialModelName, specialPropertyName); // a } /// @@ -177,8 +189,14 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index 1bf8c4ad9a0b..a78152574cd9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -38,26 +38,38 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { - Id = id; - Name = name; + IdOption = id; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d + /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,8 +125,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -133,10 +145,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -144,13 +156,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + return new Tag(id, name); // a } /// @@ -177,8 +189,14 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index 4249ff2fb47b..be4936833f4f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -37,19 +37,25 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { - Value = value; + ValueOption = value; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Value + /// + [JsonIgnore] + public Option ValueOption { get; private set; } // option d + /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -122,7 +128,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +136,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + return new TestCollectionEndingWithWordList(value); // a } /// @@ -160,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index ed130760a758..c267736dfa61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -37,19 +37,25 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option?> testCollectionEndingWithWordList = default) { - TestCollectionEndingWithWordList = testCollectionEndingWithWordList; + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + public Option?> TestCollectionEndingWithWordListOption { get; private set; } // option d + /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -104,7 +110,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? testCollectionEndingWithWordList = default; + Option?> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -123,7 +129,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -131,10 +137,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a } /// @@ -161,8 +167,12 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index dd3c3ec026a0..090acbb01537 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -37,19 +37,25 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { - SomeProperty = someProperty; + SomePropertyOption = someProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + public Option SomePropertyOption { get; private set; } // option d + /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -115,7 +121,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -133,7 +139,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,10 +147,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a } /// @@ -171,7 +177,11 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs index bddcf663a293..aa7aa28e97a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs @@ -89,7 +89,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -211,7 +211,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -219,17 +219,20 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleType.Value!); // c if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleType.Value!); // c if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleType.Value!); // c throw new JsonException(); } @@ -273,7 +276,10 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangle.TriangleType); + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + + writer.WriteString("triangleType", triangle.TriangleType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs index adc70c646cb9..e6e1f48112a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs @@ -49,7 +49,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -104,7 +104,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -122,7 +122,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -130,10 +130,13 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); - return new TriangleInterface(triangleType); + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value!); // a } /// @@ -160,7 +163,10 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangleInterface.TriangleType); + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 684c3ff5a2e0..d0c956a6f698 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -48,101 +48,173 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { - Email = email; - FirstName = firstName; - Id = id; - LastName = lastName; - ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; - Password = password; - Phone = phone; - UserStatus = userStatus; - Username = username; - AnyTypeProp = anyTypeProp; - AnyTypePropNullable = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Email + /// + [JsonIgnore] + public Option EmailOption { get; private set; } // option d + /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + public Option FirstNameOption { get; private set; } // option d /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + public Option LastNameOption { get; private set; } // option d /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + public Option PasswordOption { get; private set; } // option d /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + public Option PhoneOption { get; private set; } // option d /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + public Option UserStatusOption { get; private set; } // option d /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + public Option UsernameOption { get; private set; } // option d /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + public Option AnyTypePropOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get; set; } + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + public Option AnyTypePropNullableOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get; set; } + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get; set; } + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -208,18 +280,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? email = default; - string? firstName = default; - long? id = default; - string? lastName = default; - Object? objectWithNoDeclaredProps = default; - string? password = default; - string? phone = default; - int? userStatus = default; - string? username = default; - Object? anyTypeProp = default; - Object? anyTypePropNullable = default; - Object? objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -237,46 +309,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()!); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()!); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -284,34 +356,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a } /// @@ -338,22 +410,78 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); // 1 + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); // 1 + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); // 1 + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); // 1 + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); // 1 + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); // 1 + + if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index 7d320ced8bb2..a476d1bc5b05 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -39,11 +39,11 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; - HasBaleen = hasBaleen; - HasTeeth = hasTeeth; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; OnCreated(); } @@ -53,19 +53,31 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + public Option HasBaleenOption { get; private set; } // option d /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + public Option HasTeethOption { get; private set; } // option d /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -122,9 +134,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -142,15 +154,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -158,16 +170,19 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + return new Whale(className.Value!, hasBaleen, hasTeeth); // a } /// @@ -194,9 +209,16 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); // 1 + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 05aa8852c983..6a4179e25f09 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -38,10 +38,10 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; - Type = type; + TypeOption = type; OnCreated(); } @@ -113,9 +113,8 @@ public static TypeEnum TypeEnumFromString(string value) /// /// /// - public static string TypeEnumToJsonValue(TypeEnum value) + public static string TypeEnumToJsonValue(TypeEnum? value) { - if (value == TypeEnum.Plains) return "plains"; @@ -128,17 +127,23 @@ public static string TypeEnumToJsonValue(TypeEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option a + /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -205,8 +210,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -224,13 +229,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -238,13 +242,16 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + return new Zebra(className.Value!, type); // a } /// @@ -271,9 +278,12 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); // 1 - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index 4240d64e5bdc..b1a3ce3bf47a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -37,9 +37,9 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { - ZeroBasedEnum = zeroBasedEnum; + ZeroBasedEnumOption = zeroBasedEnum; OnCreated(); } @@ -100,9 +100,8 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// /// /// - public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -112,11 +111,17 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + public Option ZeroBasedEnumOption { get; private set; } // option a + /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -171,7 +176,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -190,9 +195,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -200,10 +204,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + return new ZeroBasedEnumClass(zeroBasedEnum); // a } /// @@ -230,8 +234,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else From 120ba1fbe44ff802b6df6a382d5ad1b845577b39 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 13:24:46 -0500 Subject: [PATCH 15/23] fixed all samples --- .../csharp/NullConditionalProperty.mustache | 2 +- .../generichost/JsonConverter.mustache | 24 +- .../generichost/ValidateRegex.mustache | 2 +- .../generichost/modelGeneric.mustache | 8 +- .../.openapi-generator/FILES | 2 + .../README.md | 1 + .../api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1954 ++++++++++++++ .../UnitTest1.cs | 2 +- .../.openapi-generator/VERSION | 2 +- .../Model/DateOnlyClass.cs | 2 +- .../UseSourceGeneration/Model/FormatTest.cs | 2 +- .../.openapi-generator/FILES | 2 + .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 452 ++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 31 +- .../ActivityOutputElementRepresentation.cs | 56 +- .../Model/AdditionalPropertiesClass.cs | 211 +- .../src/Org.OpenAPITools/Model/Animal.cs | 48 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 76 +- .../src/Org.OpenAPITools/Model/Apple.cs | 94 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 45 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 31 +- .../Model/ArrayOfNumberOnly.cs | 31 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 83 +- .../src/Org.OpenAPITools/Model/Banana.cs | 26 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 42 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 21 +- .../Org.OpenAPITools/Model/Capitalization.cs | 154 +- .../src/Org.OpenAPITools/Model/Cat.cs | 58 +- .../src/Org.OpenAPITools/Model/Category.cs | 61 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 55 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 29 +- .../Model/ComplexQuadrilateral.cs | 40 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 21 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 26 +- .../Model/DeprecatedObject.cs | 29 +- .../src/Org.OpenAPITools/Model/Dog.cs | 67 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 105 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 59 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 545 ++-- .../Model/EquilateralTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/File.cs | 29 +- .../Model/FileSchemaTestClass.cs | 57 +- .../src/Org.OpenAPITools/Model/Foo.cs | 29 +- .../Model/FooGetDefaultResponse.cs | 31 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 558 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 35 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 5 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 68 +- .../Model/GrandparentAnimal.cs | 21 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 62 +- .../Model/HealthCheckResult.cs | 25 +- .../Model/IsoscelesTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/List.cs | 29 +- .../Model/LiteralStringClass.cs | 54 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 25 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 112 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 99 +- .../Model/Model200Response.cs | 51 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 29 +- .../src/Org.OpenAPITools/Model/Name.cs | 97 +- ...cationtestGetElementsV1ResponseMPayload.cs | 36 +- .../Org.OpenAPITools/Model/NullableClass.cs | 299 ++- .../Model/NullableGuidClass.cs | 29 +- .../Org.OpenAPITools/Model/NullableShape.cs | 23 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 26 +- .../Model/ObjectWithDeprecatedFields.cs | 103 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 5 +- .../src/Org.OpenAPITools/Model/Order.cs | 139 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 73 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- .../src/Org.OpenAPITools/Model/Pet.cs | 175 +- .../src/Org.OpenAPITools/Model/Pig.cs | 23 +- .../Model/PolymorphicProperty.cs | 9 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 23 +- .../Model/QuadrilateralInterface.cs | 21 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2364 +++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 26 +- .../Model/RolesReportsHash.cs | 52 +- .../Model/RolesReportsHashRole.cs | 29 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/Shape.cs | 23 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 23 +- .../Model/SimpleQuadrilateral.cs | 40 +- .../Model/SpecialModelName.cs | 51 +- .../src/Org.OpenAPITools/Model/Tag.cs | 51 +- .../Model/TestCollectionEndingWithWordList.cs | 29 +- .../TestCollectionEndingWithWordListObject.cs | 31 +- ...lineFreeformAdditionalPropertiesRequest.cs | 29 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 25 +- .../Model/TriangleInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/User.cs | 297 ++- .../src/Org.OpenAPITools/Model/Whale.cs | 67 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 49 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 32 +- .../.openapi-generator/FILES | 2 + .../.openapi-generator/VERSION | 2 +- .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 452 ++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 31 +- .../ActivityOutputElementRepresentation.cs | 56 +- .../Model/AdditionalPropertiesClass.cs | 211 +- .../src/Org.OpenAPITools/Model/Animal.cs | 48 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 76 +- .../src/Org.OpenAPITools/Model/Apple.cs | 94 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 45 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 31 +- .../Model/ArrayOfNumberOnly.cs | 31 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 83 +- .../src/Org.OpenAPITools/Model/Banana.cs | 26 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 42 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 21 +- .../Org.OpenAPITools/Model/Capitalization.cs | 154 +- .../src/Org.OpenAPITools/Model/Cat.cs | 58 +- .../src/Org.OpenAPITools/Model/Category.cs | 61 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 55 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 29 +- .../Model/ComplexQuadrilateral.cs | 40 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 21 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 28 +- .../Model/DeprecatedObject.cs | 29 +- .../src/Org.OpenAPITools/Model/Dog.cs | 67 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 105 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 57 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 545 ++-- .../Model/EquilateralTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/File.cs | 29 +- .../Model/FileSchemaTestClass.cs | 57 +- .../src/Org.OpenAPITools/Model/Foo.cs | 29 +- .../Model/FooGetDefaultResponse.cs | 31 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 560 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 35 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 5 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 68 +- .../Model/GrandparentAnimal.cs | 21 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 62 +- .../Model/HealthCheckResult.cs | 25 +- .../Model/IsoscelesTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/List.cs | 29 +- .../Model/LiteralStringClass.cs | 54 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 25 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 110 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 99 +- .../Model/Model200Response.cs | 51 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 29 +- .../src/Org.OpenAPITools/Model/Name.cs | 97 +- ...cationtestGetElementsV1ResponseMPayload.cs | 36 +- .../Org.OpenAPITools/Model/NullableClass.cs | 299 ++- .../Model/NullableGuidClass.cs | 29 +- .../Org.OpenAPITools/Model/NullableShape.cs | 23 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 26 +- .../Model/ObjectWithDeprecatedFields.cs | 103 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 5 +- .../src/Org.OpenAPITools/Model/Order.cs | 139 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 73 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- .../src/Org.OpenAPITools/Model/Pet.cs | 175 +- .../src/Org.OpenAPITools/Model/Pig.cs | 23 +- .../Model/PolymorphicProperty.cs | 9 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 23 +- .../Model/QuadrilateralInterface.cs | 21 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2362 ++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 26 +- .../Model/RolesReportsHash.cs | 52 +- .../Model/RolesReportsHashRole.cs | 29 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/Shape.cs | 23 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 23 +- .../Model/SimpleQuadrilateral.cs | 40 +- .../Model/SpecialModelName.cs | 51 +- .../src/Org.OpenAPITools/Model/Tag.cs | 51 +- .../Model/TestCollectionEndingWithWordList.cs | 29 +- .../TestCollectionEndingWithWordListObject.cs | 31 +- ...lineFreeformAdditionalPropertiesRequest.cs | 29 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 25 +- .../Model/TriangleInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/User.cs | 297 ++- .../src/Org.OpenAPITools/Model/Whale.cs | 67 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 49 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 32 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Adult.cs | 75 +- .../src/Org.OpenAPITools/Model/Child.cs | 93 +- .../src/Org.OpenAPITools/Model/Person.cs | 79 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Apple.cs | 29 +- .../src/Org.OpenAPITools/Model/Banana.cs | 26 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 68 +- .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Apple.cs | 29 +- .../src/Org.OpenAPITools/Model/Banana.cs | 26 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 35 +- .../.openapi-generator/FILES | 2 + .../.openapi-generator/VERSION | 2 +- .../api/openapi.yaml | 258 ++ .../docs/models/Category.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/FormatTest.md | 6 +- .../docs/models/Pet.md | 4 +- .../docs/models/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 452 ++++ .../Org.OpenAPITools/Client/ClientUtils.cs | 28 +- .../Client/HostConfiguration.cs | 1 + .../src/Org.OpenAPITools/Client/Option.cs | 12 + .../src/Org.OpenAPITools/Model/Activity.cs | 31 +- .../ActivityOutputElementRepresentation.cs | 56 +- .../Model/AdditionalPropertiesClass.cs | 211 +- .../src/Org.OpenAPITools/Model/Animal.cs | 48 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 76 +- .../src/Org.OpenAPITools/Model/Apple.cs | 94 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 45 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 31 +- .../Model/ArrayOfNumberOnly.cs | 31 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 83 +- .../src/Org.OpenAPITools/Model/Banana.cs | 26 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 42 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 21 +- .../Org.OpenAPITools/Model/Capitalization.cs | 154 +- .../src/Org.OpenAPITools/Model/Cat.cs | 58 +- .../src/Org.OpenAPITools/Model/Category.cs | 61 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 55 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 29 +- .../Model/ComplexQuadrilateral.cs | 40 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 21 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 28 +- .../Model/DeprecatedObject.cs | 29 +- .../src/Org.OpenAPITools/Model/Dog.cs | 67 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 105 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 57 +- .../src/Org.OpenAPITools/Model/EnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/EnumTest.cs | 545 ++-- .../Model/EquilateralTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/File.cs | 29 +- .../Model/FileSchemaTestClass.cs | 57 +- .../src/Org.OpenAPITools/Model/Foo.cs | 29 +- .../Model/FooGetDefaultResponse.cs | 31 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 560 ++-- .../src/Org.OpenAPITools/Model/Fruit.cs | 35 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 5 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 68 +- .../Model/GrandparentAnimal.cs | 21 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 62 +- .../Model/HealthCheckResult.cs | 25 +- .../Model/IsoscelesTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/List.cs | 29 +- .../Model/LiteralStringClass.cs | 54 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 25 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 110 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 99 +- .../Model/Model200Response.cs | 51 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 29 +- .../src/Org.OpenAPITools/Model/Name.cs | 97 +- ...cationtestGetElementsV1ResponseMPayload.cs | 36 +- .../Org.OpenAPITools/Model/NullableClass.cs | 299 ++- .../Model/NullableGuidClass.cs | 29 +- .../Org.OpenAPITools/Model/NullableShape.cs | 23 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 26 +- .../Model/ObjectWithDeprecatedFields.cs | 103 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 5 +- .../src/Org.OpenAPITools/Model/Order.cs | 139 +- .../Org.OpenAPITools/Model/OuterComposite.cs | 73 +- .../src/Org.OpenAPITools/Model/OuterEnum.cs | 1 + .../Model/OuterEnumDefaultValue.cs | 1 + .../Model/OuterEnumInteger.cs | 1 + .../Model/OuterEnumIntegerDefaultValue.cs | 1 + .../Org.OpenAPITools/Model/OuterEnumTest.cs | 1 + .../src/Org.OpenAPITools/Model/ParentPet.cs | 19 +- .../src/Org.OpenAPITools/Model/Pet.cs | 175 +- .../src/Org.OpenAPITools/Model/Pig.cs | 23 +- .../Model/PolymorphicProperty.cs | 9 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 23 +- .../Model/QuadrilateralInterface.cs | 21 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 2362 ++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 26 +- .../Model/RolesReportsHash.cs | 52 +- .../Model/RolesReportsHashRole.cs | 29 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 40 +- .../src/Org.OpenAPITools/Model/Shape.cs | 23 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 23 +- .../Model/SimpleQuadrilateral.cs | 40 +- .../Model/SpecialModelName.cs | 51 +- .../src/Org.OpenAPITools/Model/Tag.cs | 51 +- .../Model/TestCollectionEndingWithWordList.cs | 29 +- .../TestCollectionEndingWithWordListObject.cs | 31 +- ...lineFreeformAdditionalPropertiesRequest.cs | 29 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 25 +- .../Model/TriangleInterface.cs | 21 +- .../src/Org.OpenAPITools/Model/User.cs | 297 ++- .../src/Org.OpenAPITools/Model/Whale.cs | 67 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 49 +- .../Org.OpenAPITools/Model/ZeroBasedEnum.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 32 +- .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-httpclient/README.md | 1 + .../OpenAPIClient-httpclient/api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1043 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net47/README.md | 1 + .../OpenAPIClient-net47/api/openapi.yaml | 258 ++ .../OpenAPIClient-net47/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net48/README.md | 1 + .../OpenAPIClient-net48/api/openapi.yaml | 258 ++ .../OpenAPIClient-net48/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClient-net5.0/README.md | 1 + .../OpenAPIClient-net5.0/api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../OpenAPIClient-unityWebRequest/README.md | 1 + .../api/openapi.yaml | 258 ++ .../docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 410 +++ .../Org.OpenAPITools/Model/RequiredClass.cs | 1224 +++++++++ .../OpenAPIClient/.openapi-generator/FILES | 2 + .../petstore/csharp/OpenAPIClient/README.md | 1 + .../csharp/OpenAPIClient/api/openapi.yaml | 258 ++ .../OpenAPIClient/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1042 ++++++++ .../.openapi-generator/FILES | 2 + .../csharp/OpenAPIClientCore/README.md | 1 + .../csharp/OpenAPIClientCore/api/openapi.yaml | 258 ++ .../OpenAPIClientCore/docs/RequiredClass.md | 53 + .../Model/RequiredClassTests.cs | 453 ++++ .../src/Org.OpenAPITools/Model/Apple.cs | 27 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 1027 +++++++ .../src/Org.OpenAPITools/Model/Category.cs | 9 +- 395 files changed, 36870 insertions(+), 5876 deletions(-) create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs create mode 100644 samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs diff --git a/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache b/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache index 64dd45277c77..7dcafa8033e4 100644 --- a/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/NullConditionalProperty.mustache @@ -1 +1 @@ -{{#lambda.first}}{{#isNullable}}{{nrt?}} {{^nrt}}{{#vendorExtensions.x-is-value-type}}? {{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/isNullable}}{{^required}}{{nrt?}} {{^nrt}}{{#vendorExtensions.x-is-value-type}}? {{/vendorExtensions.x-is-value-type}}{{/nrt}}{{/required}}{{/lambda.first}} \ No newline at end of file +{{#lambda.first}}{{#isNullable}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} \ No newline at end of file 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 191ef894231e..95cc8c3a1419 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 @@ -280,7 +280,7 @@ {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value!{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c {{#-last}} throw new JsonException(); @@ -299,7 +299,7 @@ {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}!.Value!{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value!{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value!{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} @@ -394,7 +394,7 @@ {{/isString}} {{#isBoolean}} {{#lambda.copy}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -403,7 +403,7 @@ {{^isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -412,7 +412,7 @@ {{/isEnum}} {{#isDate}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -420,7 +420,7 @@ {{/isDate}} {{#isDateTime}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -429,7 +429,7 @@ {{#isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -438,7 +438,7 @@ {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}!.Value{{/isNullable}}{{/required}}); // 7 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}{{nrt!}}.Value{{/isNullable}}{{/required}}); // 7 if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -493,9 +493,9 @@ {{^required}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 10 {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option!.Value != null) // 10 a + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option{{nrt!}}.Value != null) // 10 a { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value!.Value); // 10 c + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value{{nrt!}}.Value); // 10 c writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } else @@ -503,7 +503,7 @@ {{/isNullable}} {{^isNullable}} { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}!.Value); // 10 b + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{nrt!}}.Value); // 10 b writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } {{/isNullable}} @@ -514,7 +514,7 @@ {{/isEnum}} {{#isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}!.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache index 3abce62ff37a..78aba8fb3456 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/ValidateRegex.mustache @@ -1,7 +1,7 @@ // {{{name}}} ({{{dataType}}}) pattern Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); {{#lambda.copy}}this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null && {{/lambda.copy}} -if ({{#lambda.first}}{{^required}}{{#lambda.pasteLine}}{{/lambda.pasteLine}} {{/required}}{{#isNullable}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/isNullable}}{{/lambda.first}}!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{#lambda.first}}{{^required}}! {{/required}}{{#isNullable}}! {{/isNullable}}{{/lambda.first}}{{/isUuid}}).Success) +if ({{#lambda.first}}{{^required}}{{#lambda.pasteLine}}{{/lambda.pasteLine}} {{/required}}{{#isNullable}}{{#lambda.pasteLine}}{{/lambda.pasteLine}}{{/isNullable}}{{/lambda.first}}!regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{#lambda.first}}{{^required}}{{nrt!}} {{/required}}{{#isNullable}}! {{/isNullable}}{{/lambda.first}}{{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); } \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 1853c889eb1e..0975cf0785d1 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -105,7 +105,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // a + public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // a {{/isEnum}} {{/vars}} @@ -129,7 +129,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new(value); } {{/isReadOnly}}}{{/required}} // b + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // b {{/vendorExtensions.x-duplicated-data-type}} {{/composedSchemas.anyOf}} @@ -172,7 +172,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // c + public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // c {{/isNew}} {{/isInherited}} @@ -196,7 +196,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new(value); } {{/isReadOnly}}}{{/required}} // d + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // d {{/isInherited}} {{/isEnum}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md index af827f28641e..c2d5ddeb3539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/README.md @@ -221,6 +221,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs index 031f318ee0e4..b872ab7d9b25 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs @@ -220,28 +220,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs index 73785b74a8fe..45aeb448ee99 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs @@ -834,10 +834,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -855,28 +862,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 7f449dad8a66..2125bde56e75 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,10 +255,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..a3bfdf702066 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1954 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger + { + get{ return _RequiredNullableEnumInteger;} + set + { + _RequiredNullableEnumInteger = value; + _flagRequiredNullableEnumInteger = true; + } + } + private RequiredNullableEnumIntegerEnum _RequiredNullableEnumInteger; + private bool _flagRequiredNullableEnumInteger; + + /// + /// Returns false as RequiredNullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumInteger() + { + return _flagRequiredNullableEnumInteger; + } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger + { + get{ return _RequiredNotnullableEnumInteger;} + set + { + _RequiredNotnullableEnumInteger = value; + _flagRequiredNotnullableEnumInteger = true; + } + } + private RequiredNotnullableEnumIntegerEnum _RequiredNotnullableEnumInteger; + private bool _flagRequiredNotnullableEnumInteger; + + /// + /// Returns false as RequiredNotnullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumInteger() + { + return _flagRequiredNotnullableEnumInteger; + } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger + { + get{ return _NotrequiredNullableEnumInteger;} + set + { + _NotrequiredNullableEnumInteger = value; + _flagNotrequiredNullableEnumInteger = true; + } + } + private NotrequiredNullableEnumIntegerEnum? _NotrequiredNullableEnumInteger; + private bool _flagNotrequiredNullableEnumInteger; + + /// + /// Returns false as NotrequiredNullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumInteger() + { + return _flagNotrequiredNullableEnumInteger; + } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger + { + get{ return _NotrequiredNotnullableEnumInteger;} + set + { + _NotrequiredNotnullableEnumInteger = value; + _flagNotrequiredNotnullableEnumInteger = true; + } + } + private NotrequiredNotnullableEnumIntegerEnum? _NotrequiredNotnullableEnumInteger; + private bool _flagNotrequiredNotnullableEnumInteger; + + /// + /// Returns false as NotrequiredNotnullableEnumInteger should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumInteger() + { + return _flagNotrequiredNotnullableEnumInteger; + } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly + { + get{ return _RequiredNullableEnumIntegerOnly;} + set + { + _RequiredNullableEnumIntegerOnly = value; + _flagRequiredNullableEnumIntegerOnly = true; + } + } + private RequiredNullableEnumIntegerOnlyEnum _RequiredNullableEnumIntegerOnly; + private bool _flagRequiredNullableEnumIntegerOnly; + + /// + /// Returns false as RequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumIntegerOnly() + { + return _flagRequiredNullableEnumIntegerOnly; + } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly + { + get{ return _RequiredNotnullableEnumIntegerOnly;} + set + { + _RequiredNotnullableEnumIntegerOnly = value; + _flagRequiredNotnullableEnumIntegerOnly = true; + } + } + private RequiredNotnullableEnumIntegerOnlyEnum _RequiredNotnullableEnumIntegerOnly; + private bool _flagRequiredNotnullableEnumIntegerOnly; + + /// + /// Returns false as RequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumIntegerOnly() + { + return _flagRequiredNotnullableEnumIntegerOnly; + } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly + { + get{ return _NotrequiredNullableEnumIntegerOnly;} + set + { + _NotrequiredNullableEnumIntegerOnly = value; + _flagNotrequiredNullableEnumIntegerOnly = true; + } + } + private NotrequiredNullableEnumIntegerOnlyEnum? _NotrequiredNullableEnumIntegerOnly; + private bool _flagNotrequiredNullableEnumIntegerOnly; + + /// + /// Returns false as NotrequiredNullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumIntegerOnly() + { + return _flagNotrequiredNullableEnumIntegerOnly; + } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly + { + get{ return _NotrequiredNotnullableEnumIntegerOnly;} + set + { + _NotrequiredNotnullableEnumIntegerOnly = value; + _flagNotrequiredNotnullableEnumIntegerOnly = true; + } + } + private NotrequiredNotnullableEnumIntegerOnlyEnum? _NotrequiredNotnullableEnumIntegerOnly; + private bool _flagNotrequiredNotnullableEnumIntegerOnly; + + /// + /// Returns false as NotrequiredNotnullableEnumIntegerOnly should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumIntegerOnly() + { + return _flagNotrequiredNotnullableEnumIntegerOnly; + } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString + { + get{ return _RequiredNotnullableEnumString;} + set + { + _RequiredNotnullableEnumString = value; + _flagRequiredNotnullableEnumString = true; + } + } + private RequiredNotnullableEnumStringEnum _RequiredNotnullableEnumString; + private bool _flagRequiredNotnullableEnumString; + + /// + /// Returns false as RequiredNotnullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableEnumString() + { + return _flagRequiredNotnullableEnumString; + } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString + { + get{ return _RequiredNullableEnumString;} + set + { + _RequiredNullableEnumString = value; + _flagRequiredNullableEnumString = true; + } + } + private RequiredNullableEnumStringEnum _RequiredNullableEnumString; + private bool _flagRequiredNullableEnumString; + + /// + /// Returns false as RequiredNullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableEnumString() + { + return _flagRequiredNullableEnumString; + } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString + { + get{ return _NotrequiredNullableEnumString;} + set + { + _NotrequiredNullableEnumString = value; + _flagNotrequiredNullableEnumString = true; + } + } + private NotrequiredNullableEnumStringEnum? _NotrequiredNullableEnumString; + private bool _flagNotrequiredNullableEnumString; + + /// + /// Returns false as NotrequiredNullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableEnumString() + { + return _flagNotrequiredNullableEnumString; + } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString + { + get{ return _NotrequiredNotnullableEnumString;} + set + { + _NotrequiredNotnullableEnumString = value; + _flagNotrequiredNotnullableEnumString = true; + } + } + private NotrequiredNotnullableEnumStringEnum? _NotrequiredNotnullableEnumString; + private bool _flagNotrequiredNotnullableEnumString; + + /// + /// Returns false as NotrequiredNotnullableEnumString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableEnumString() + { + return _flagNotrequiredNotnullableEnumString; + } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue + { + get{ return _RequiredNullableOuterEnumDefaultValue;} + set + { + _RequiredNullableOuterEnumDefaultValue = value; + _flagRequiredNullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue _RequiredNullableOuterEnumDefaultValue; + private bool _flagRequiredNullableOuterEnumDefaultValue; + + /// + /// Returns false as RequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableOuterEnumDefaultValue() + { + return _flagRequiredNullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue + { + get{ return _RequiredNotnullableOuterEnumDefaultValue;} + set + { + _RequiredNotnullableOuterEnumDefaultValue = value; + _flagRequiredNotnullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue _RequiredNotnullableOuterEnumDefaultValue; + private bool _flagRequiredNotnullableOuterEnumDefaultValue; + + /// + /// Returns false as RequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableOuterEnumDefaultValue() + { + return _flagRequiredNotnullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue + { + get{ return _NotrequiredNullableOuterEnumDefaultValue;} + set + { + _NotrequiredNullableOuterEnumDefaultValue = value; + _flagNotrequiredNullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue? _NotrequiredNullableOuterEnumDefaultValue; + private bool _flagNotrequiredNullableOuterEnumDefaultValue; + + /// + /// Returns false as NotrequiredNullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableOuterEnumDefaultValue() + { + return _flagNotrequiredNullableOuterEnumDefaultValue; + } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue + { + get{ return _NotrequiredNotnullableOuterEnumDefaultValue;} + set + { + _NotrequiredNotnullableOuterEnumDefaultValue = value; + _flagNotrequiredNotnullableOuterEnumDefaultValue = true; + } + } + private OuterEnumDefaultValue? _NotrequiredNotnullableOuterEnumDefaultValue; + private bool _flagNotrequiredNotnullableOuterEnumDefaultValue; + + /// + /// Returns false as NotrequiredNotnullableOuterEnumDefaultValue should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableOuterEnumDefaultValue() + { + return _flagNotrequiredNotnullableOuterEnumDefaultValue; + } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableIntegerProp = requiredNullableIntegerProp; + this._RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableBooleanProp = requiredNullableBooleanProp; + this._RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableDateProp = requiredNullableDateProp; + this._RequiredNotNullableDateProp = requiredNotNullableDateProp; + this._RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this._RequiredNullableEnumInteger = requiredNullableEnumInteger; + this._RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this._RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this._RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this._RequiredNotnullableEnumString = requiredNotnullableEnumString; + this._RequiredNullableEnumString = requiredNullableEnumString; + this._RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this._RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableUuid = requiredNullableUuid; + this._RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this._RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this._RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this._NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + if (this.NotRequiredNullableIntegerProp != null) + { + this._flagNotRequiredNullableIntegerProp = true; + } + this._NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + if (this.NotRequiredNotnullableintegerProp != null) + { + this._flagNotRequiredNotnullableintegerProp = true; + } + this._NotrequiredNullableStringProp = notrequiredNullableStringProp; + if (this.NotrequiredNullableStringProp != null) + { + this._flagNotrequiredNullableStringProp = true; + } + this._NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + if (this.NotrequiredNotnullableStringProp != null) + { + this._flagNotrequiredNotnullableStringProp = true; + } + this._NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + if (this.NotrequiredNullableBooleanProp != null) + { + this._flagNotrequiredNullableBooleanProp = true; + } + this._NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + if (this.NotrequiredNotnullableBooleanProp != null) + { + this._flagNotrequiredNotnullableBooleanProp = true; + } + this._NotRequiredNullableDateProp = notRequiredNullableDateProp; + if (this.NotRequiredNullableDateProp != null) + { + this._flagNotRequiredNullableDateProp = true; + } + this._NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + if (this.NotRequiredNotnullableDateProp != null) + { + this._flagNotRequiredNotnullableDateProp = true; + } + this._NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + if (this.NotrequiredNullableDatetimeProp != null) + { + this._flagNotrequiredNullableDatetimeProp = true; + } + this._NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + if (this.NotrequiredNotnullableDatetimeProp != null) + { + this._flagNotrequiredNotnullableDatetimeProp = true; + } + this._NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + if (this.NotrequiredNullableEnumInteger != null) + { + this._flagNotrequiredNullableEnumInteger = true; + } + this._NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + if (this.NotrequiredNotnullableEnumInteger != null) + { + this._flagNotrequiredNotnullableEnumInteger = true; + } + this._NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + if (this.NotrequiredNullableEnumIntegerOnly != null) + { + this._flagNotrequiredNullableEnumIntegerOnly = true; + } + this._NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + if (this.NotrequiredNotnullableEnumIntegerOnly != null) + { + this._flagNotrequiredNotnullableEnumIntegerOnly = true; + } + this._NotrequiredNullableEnumString = notrequiredNullableEnumString; + if (this.NotrequiredNullableEnumString != null) + { + this._flagNotrequiredNullableEnumString = true; + } + this._NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + if (this.NotrequiredNotnullableEnumString != null) + { + this._flagNotrequiredNotnullableEnumString = true; + } + this._NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + if (this.NotrequiredNullableOuterEnumDefaultValue != null) + { + this._flagNotrequiredNullableOuterEnumDefaultValue = true; + } + this._NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + if (this.NotrequiredNotnullableOuterEnumDefaultValue != null) + { + this._flagNotrequiredNotnullableOuterEnumDefaultValue = true; + } + this._NotrequiredNullableUuid = notrequiredNullableUuid; + if (this.NotrequiredNullableUuid != null) + { + this._flagNotrequiredNullableUuid = true; + } + this._NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + if (this.NotrequiredNotnullableUuid != null) + { + this._flagNotrequiredNotnullableUuid = true; + } + this._NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + if (this.NotrequiredNullableArrayOfString != null) + { + this._flagNotrequiredNullableArrayOfString = true; + } + this._NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + if (this.NotrequiredNotnullableArrayOfString != null) + { + this._flagNotrequiredNotnullableArrayOfString = true; + } + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp + { + get{ return _RequiredNullableIntegerProp;} + set + { + _RequiredNullableIntegerProp = value; + _flagRequiredNullableIntegerProp = true; + } + } + private int? _RequiredNullableIntegerProp; + private bool _flagRequiredNullableIntegerProp; + + /// + /// Returns false as RequiredNullableIntegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableIntegerProp() + { + return _flagRequiredNullableIntegerProp; + } + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp + { + get{ return _RequiredNotnullableintegerProp;} + set + { + _RequiredNotnullableintegerProp = value; + _flagRequiredNotnullableintegerProp = true; + } + } + private int _RequiredNotnullableintegerProp; + private bool _flagRequiredNotnullableintegerProp; + + /// + /// Returns false as RequiredNotnullableintegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableintegerProp() + { + return _flagRequiredNotnullableintegerProp; + } + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp + { + get{ return _NotRequiredNullableIntegerProp;} + set + { + _NotRequiredNullableIntegerProp = value; + _flagNotRequiredNullableIntegerProp = true; + } + } + private int? _NotRequiredNullableIntegerProp; + private bool _flagNotRequiredNullableIntegerProp; + + /// + /// Returns false as NotRequiredNullableIntegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNullableIntegerProp() + { + return _flagNotRequiredNullableIntegerProp; + } + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp + { + get{ return _NotRequiredNotnullableintegerProp;} + set + { + _NotRequiredNotnullableintegerProp = value; + _flagNotRequiredNotnullableintegerProp = true; + } + } + private int _NotRequiredNotnullableintegerProp; + private bool _flagNotRequiredNotnullableintegerProp; + + /// + /// Returns false as NotRequiredNotnullableintegerProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNotnullableintegerProp() + { + return _flagNotRequiredNotnullableintegerProp; + } + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp + { + get{ return _RequiredNullableStringProp;} + set + { + _RequiredNullableStringProp = value; + _flagRequiredNullableStringProp = true; + } + } + private string _RequiredNullableStringProp; + private bool _flagRequiredNullableStringProp; + + /// + /// Returns false as RequiredNullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableStringProp() + { + return _flagRequiredNullableStringProp; + } + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp + { + get{ return _RequiredNotnullableStringProp;} + set + { + _RequiredNotnullableStringProp = value; + _flagRequiredNotnullableStringProp = true; + } + } + private string _RequiredNotnullableStringProp; + private bool _flagRequiredNotnullableStringProp; + + /// + /// Returns false as RequiredNotnullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableStringProp() + { + return _flagRequiredNotnullableStringProp; + } + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp + { + get{ return _NotrequiredNullableStringProp;} + set + { + _NotrequiredNullableStringProp = value; + _flagNotrequiredNullableStringProp = true; + } + } + private string _NotrequiredNullableStringProp; + private bool _flagNotrequiredNullableStringProp; + + /// + /// Returns false as NotrequiredNullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableStringProp() + { + return _flagNotrequiredNullableStringProp; + } + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp + { + get{ return _NotrequiredNotnullableStringProp;} + set + { + _NotrequiredNotnullableStringProp = value; + _flagNotrequiredNotnullableStringProp = true; + } + } + private string _NotrequiredNotnullableStringProp; + private bool _flagNotrequiredNotnullableStringProp; + + /// + /// Returns false as NotrequiredNotnullableStringProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableStringProp() + { + return _flagNotrequiredNotnullableStringProp; + } + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp + { + get{ return _RequiredNullableBooleanProp;} + set + { + _RequiredNullableBooleanProp = value; + _flagRequiredNullableBooleanProp = true; + } + } + private bool? _RequiredNullableBooleanProp; + private bool _flagRequiredNullableBooleanProp; + + /// + /// Returns false as RequiredNullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableBooleanProp() + { + return _flagRequiredNullableBooleanProp; + } + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp + { + get{ return _RequiredNotnullableBooleanProp;} + set + { + _RequiredNotnullableBooleanProp = value; + _flagRequiredNotnullableBooleanProp = true; + } + } + private bool _RequiredNotnullableBooleanProp; + private bool _flagRequiredNotnullableBooleanProp; + + /// + /// Returns false as RequiredNotnullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableBooleanProp() + { + return _flagRequiredNotnullableBooleanProp; + } + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp + { + get{ return _NotrequiredNullableBooleanProp;} + set + { + _NotrequiredNullableBooleanProp = value; + _flagNotrequiredNullableBooleanProp = true; + } + } + private bool? _NotrequiredNullableBooleanProp; + private bool _flagNotrequiredNullableBooleanProp; + + /// + /// Returns false as NotrequiredNullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableBooleanProp() + { + return _flagNotrequiredNullableBooleanProp; + } + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp + { + get{ return _NotrequiredNotnullableBooleanProp;} + set + { + _NotrequiredNotnullableBooleanProp = value; + _flagNotrequiredNotnullableBooleanProp = true; + } + } + private bool _NotrequiredNotnullableBooleanProp; + private bool _flagNotrequiredNotnullableBooleanProp; + + /// + /// Returns false as NotrequiredNotnullableBooleanProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableBooleanProp() + { + return _flagNotrequiredNotnullableBooleanProp; + } + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDateProp + { + get{ return _RequiredNullableDateProp;} + set + { + _RequiredNullableDateProp = value; + _flagRequiredNullableDateProp = true; + } + } + private DateTime? _RequiredNullableDateProp; + private bool _flagRequiredNullableDateProp; + + /// + /// Returns false as RequiredNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableDateProp() + { + return _flagRequiredNullableDateProp; + } + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotNullableDateProp + { + get{ return _RequiredNotNullableDateProp;} + set + { + _RequiredNotNullableDateProp = value; + _flagRequiredNotNullableDateProp = true; + } + } + private DateTime _RequiredNotNullableDateProp; + private bool _flagRequiredNotNullableDateProp; + + /// + /// Returns false as RequiredNotNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotNullableDateProp() + { + return _flagRequiredNotNullableDateProp; + } + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + public DateTime? NotRequiredNullableDateProp + { + get{ return _NotRequiredNullableDateProp;} + set + { + _NotRequiredNullableDateProp = value; + _flagNotRequiredNullableDateProp = true; + } + } + private DateTime? _NotRequiredNullableDateProp; + private bool _flagNotRequiredNullableDateProp; + + /// + /// Returns false as NotRequiredNullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNullableDateProp() + { + return _flagNotRequiredNullableDateProp; + } + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonConverter(typeof(OpenAPIDateConverter))] + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + public DateTime NotRequiredNotnullableDateProp + { + get{ return _NotRequiredNotnullableDateProp;} + set + { + _NotRequiredNotnullableDateProp = value; + _flagNotRequiredNotnullableDateProp = true; + } + } + private DateTime _NotRequiredNotnullableDateProp; + private bool _flagNotRequiredNotnullableDateProp; + + /// + /// Returns false as NotRequiredNotnullableDateProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotRequiredNotnullableDateProp() + { + return _flagNotRequiredNotnullableDateProp; + } + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp + { + get{ return _RequiredNotnullableDatetimeProp;} + set + { + _RequiredNotnullableDatetimeProp = value; + _flagRequiredNotnullableDatetimeProp = true; + } + } + private DateTime _RequiredNotnullableDatetimeProp; + private bool _flagRequiredNotnullableDatetimeProp; + + /// + /// Returns false as RequiredNotnullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableDatetimeProp() + { + return _flagRequiredNotnullableDatetimeProp; + } + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp + { + get{ return _RequiredNullableDatetimeProp;} + set + { + _RequiredNullableDatetimeProp = value; + _flagRequiredNullableDatetimeProp = true; + } + } + private DateTime? _RequiredNullableDatetimeProp; + private bool _flagRequiredNullableDatetimeProp; + + /// + /// Returns false as RequiredNullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableDatetimeProp() + { + return _flagRequiredNullableDatetimeProp; + } + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp + { + get{ return _NotrequiredNullableDatetimeProp;} + set + { + _NotrequiredNullableDatetimeProp = value; + _flagNotrequiredNullableDatetimeProp = true; + } + } + private DateTime? _NotrequiredNullableDatetimeProp; + private bool _flagNotrequiredNullableDatetimeProp; + + /// + /// Returns false as NotrequiredNullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableDatetimeProp() + { + return _flagNotrequiredNullableDatetimeProp; + } + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp + { + get{ return _NotrequiredNotnullableDatetimeProp;} + set + { + _NotrequiredNotnullableDatetimeProp = value; + _flagNotrequiredNotnullableDatetimeProp = true; + } + } + private DateTime _NotrequiredNotnullableDatetimeProp; + private bool _flagNotrequiredNotnullableDatetimeProp; + + /// + /// Returns false as NotrequiredNotnullableDatetimeProp should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableDatetimeProp() + { + return _flagNotrequiredNotnullableDatetimeProp; + } + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid + { + get{ return _RequiredNullableUuid;} + set + { + _RequiredNullableUuid = value; + _flagRequiredNullableUuid = true; + } + } + private Guid? _RequiredNullableUuid; + private bool _flagRequiredNullableUuid; + + /// + /// Returns false as RequiredNullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableUuid() + { + return _flagRequiredNullableUuid; + } + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid + { + get{ return _RequiredNotnullableUuid;} + set + { + _RequiredNotnullableUuid = value; + _flagRequiredNotnullableUuid = true; + } + } + private Guid _RequiredNotnullableUuid; + private bool _flagRequiredNotnullableUuid; + + /// + /// Returns false as RequiredNotnullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableUuid() + { + return _flagRequiredNotnullableUuid; + } + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid + { + get{ return _NotrequiredNullableUuid;} + set + { + _NotrequiredNullableUuid = value; + _flagNotrequiredNullableUuid = true; + } + } + private Guid? _NotrequiredNullableUuid; + private bool _flagNotrequiredNullableUuid; + + /// + /// Returns false as NotrequiredNullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableUuid() + { + return _flagNotrequiredNullableUuid; + } + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid + { + get{ return _NotrequiredNotnullableUuid;} + set + { + _NotrequiredNotnullableUuid = value; + _flagNotrequiredNotnullableUuid = true; + } + } + private Guid _NotrequiredNotnullableUuid; + private bool _flagNotrequiredNotnullableUuid; + + /// + /// Returns false as NotrequiredNotnullableUuid should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableUuid() + { + return _flagNotrequiredNotnullableUuid; + } + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString + { + get{ return _RequiredNullableArrayOfString;} + set + { + _RequiredNullableArrayOfString = value; + _flagRequiredNullableArrayOfString = true; + } + } + private List _RequiredNullableArrayOfString; + private bool _flagRequiredNullableArrayOfString; + + /// + /// Returns false as RequiredNullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNullableArrayOfString() + { + return _flagRequiredNullableArrayOfString; + } + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString + { + get{ return _RequiredNotnullableArrayOfString;} + set + { + _RequiredNotnullableArrayOfString = value; + _flagRequiredNotnullableArrayOfString = true; + } + } + private List _RequiredNotnullableArrayOfString; + private bool _flagRequiredNotnullableArrayOfString; + + /// + /// Returns false as RequiredNotnullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeRequiredNotnullableArrayOfString() + { + return _flagRequiredNotnullableArrayOfString; + } + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString + { + get{ return _NotrequiredNullableArrayOfString;} + set + { + _NotrequiredNullableArrayOfString = value; + _flagNotrequiredNullableArrayOfString = true; + } + } + private List _NotrequiredNullableArrayOfString; + private bool _flagNotrequiredNullableArrayOfString; + + /// + /// Returns false as NotrequiredNullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNullableArrayOfString() + { + return _flagNotrequiredNullableArrayOfString; + } + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString + { + get{ return _NotrequiredNotnullableArrayOfString;} + set + { + _NotrequiredNotnullableArrayOfString = value; + _flagNotrequiredNotnullableArrayOfString = true; + } + } + private List _NotrequiredNotnullableArrayOfString; + private bool _flagNotrequiredNotnullableArrayOfString; + + /// + /// Returns false as NotrequiredNotnullableArrayOfString should not be serialized given that it's read-only. + /// + /// false (boolean) + public bool ShouldSerializeNotrequiredNotnullableArrayOfString() + { + return _flagNotrequiredNotnullableArrayOfString; + } + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs index a9c8eaf075a3..e59c6682f74f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs @@ -132,7 +132,7 @@ public void ChildCat() ChildCat childCat = new("some name", Org.OpenAPITools.Model.ChildCat.PetTypeEnum.ChildCat); string childCatJson = JsonSerializer.Serialize(childCat, _jsonSerializerOptions); ChildCat? childCat2 = JsonSerializer.Deserialize(childCatJson, _jsonSerializerOptions); - Assert.IsTrue(childCat2 != null && childCat.PetType.Equals(childCat2.PetType) && childCat.Name.Equals(childCat2.Name)); + Assert.IsTrue(childCat2 != null && childCat.PetType.Equals(childCat2.PetType) && childCat.Name != null && childCat.Name.Equals(childCat2.Name)); } [TestMethod] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index eeacc8a0dcaf..c1755d3f3f01 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -54,7 +54,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index 2aaa7c07ca64..0bd67c8b5059 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -90,7 +90,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } // d diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..6e8958b1b749 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index ec7ac60448eb..e3234dee5bb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -143,6 +143,8 @@ public static string SanitizeFilename(string filename) return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -151,8 +153,6 @@ public static string SanitizeFilename(string filename) return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -169,6 +169,30 @@ public static string SanitizeFilename(string filename) return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs index 968417a9e748..a26741d84b71 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -116,6 +116,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs index 7aa655c9b813..e6fd1c26872d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index 22464eec75fe..ed80a50c6d4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>?> activityOutputs = default) { - ActivityOutputs = activityOutputs; + ActivityOutputsOption = activityOutputs; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + public Option>?> ActivityOutputsOption { get; private set; } // option d + /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary>? activityOutputs = default; + Option>?> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,10 +136,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + return new Activity(activityOutputs); // a } /// @@ -159,8 +166,12 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) // 14 + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 39c2e8b05e60..edf434ea59d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { - Prop1 = prop1; - Prop2 = prop2; + Prop1Option = prop1; + Prop2Option = prop2; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + public Option Prop1Option { get; private set; } // option d + /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + public Option Prop2Option { get; private set; } // option d /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? prop1 = default; - Object? prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -130,11 +143,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()!); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -142,13 +155,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + return new ActivityOutputElementRepresentation(prop1, prop2); // a } /// @@ -175,9 +188,18 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + + if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 37ab8b4f3b4a..11cb24ec9214 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -42,69 +43,117 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object? anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { - EmptyMap = emptyMap; - MapOfMapProperty = mapOfMapProperty; - MapProperty = mapProperty; - MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; - MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; - MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; - MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; - Anytype1 = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + Anytype1Option = anytype1; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + public Option EmptyMapOption { get; private set; } // option d + /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + public Option>?> MapOfMapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + public Option?> MapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + public Option Anytype1Option { get; private set; } // option d /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get; set; } + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -166,14 +215,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object? emptyMap = default; - Dictionary>? mapOfMapProperty = default; - Dictionary? mapProperty = default; - Object? mapWithUndeclaredPropertiesAnytype1 = default; - Object? mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary? mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary? mapWithUndeclaredPropertiesString = default; - Object? anytype1 = default; + Option emptyMap = default; + Option>?> mapOfMapProperty = default; + Option?> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option?> mapWithUndeclaredPropertiesAnytype3 = default; + Option?> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -192,35 +241,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -228,28 +277,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a } /// @@ -276,22 +325,56 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index dd36cad83283..7de0fa688326 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; - Color = color; + ColorOption = color; OnCreated(); } @@ -49,13 +50,19 @@ public Animal(string className, string color = @"red") /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -121,8 +128,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - string? color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -140,10 +147,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -151,13 +158,16 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className, color); + return new Animal(className.Value!, color); // a } /// @@ -184,8 +194,16 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); // 1 + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index a9e4c983c629..54e6d563eeb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,33 +38,51 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { - Code = code; - Message = message; - Type = type; + CodeOption = code; + MessageOption = message; + TypeOption = type; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Code + /// + [JsonIgnore] + public Option CodeOption { get; private set; } // option d + /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + public Option MessageOption { get; private set; } // option d /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option d /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -120,9 +139,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string? message = default; - string? type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -141,13 +160,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()!); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -155,16 +174,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + return new ApiResponse(code, message, type); // a } /// @@ -191,9 +210,20 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); // 1 + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index 39c4ddd6c25b..f8da39d01873 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,33 +38,51 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { - ColorCode = colorCode; - Cultivar = cultivar; - Origin = origin; + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + public Option ColorCodeOption { get; private set; } // option d + /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + public Option CultivarOption { get; private set; } // option d /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + public Option OriginOption { get; private set; } // option d /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -94,28 +113,31 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCodeOption.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.CultivarOption.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.OriginOption.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -147,9 +169,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? colorCode = default; - string? cultivar = default; - string? origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -167,13 +189,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()!); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -181,16 +203,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + return new Apple(colorCode, cultivar, origin); // a } /// @@ -217,9 +239,23 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); // 1 + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); // 1 + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index ca139374d181..546296312e18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; - Mealy = mealy; + MealyOption = mealy; OnCreated(); } @@ -49,13 +50,19 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get; set; } // d + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + public Option MealyOption { get; private set; } // option d /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -104,8 +111,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -123,11 +130,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()!); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -135,13 +142,16 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value!, mealy); // a } /// @@ -168,8 +178,13 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); // 1 + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 78ae23d63d61..85430bae3573 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = default) { - ArrayArrayNumber = arrayArrayNumber; + ArrayArrayNumberOption = arrayArrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + public Option>?> ArrayArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayNumber = default; + Option>?> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,10 +136,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a } /// @@ -159,8 +166,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 29af43d6c8b3..4e84736fc44e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option?> arrayNumber = default) { - ArrayNumber = arrayNumber; + ArrayNumberOption = arrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + public Option?> ArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayNumber = default; + Option?> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,10 +136,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + return new ArrayOfNumberOnly(arrayNumber); // a } /// @@ -159,8 +166,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index c021f61cca54..4b4d6bb2f56e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,33 +38,51 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>?> arrayArrayOfInteger = default, Option>?> arrayArrayOfModel = default, Option?> arrayOfString = default) { - ArrayArrayOfInteger = arrayArrayOfInteger; - ArrayArrayOfModel = arrayArrayOfModel; - ArrayOfString = arrayOfString; + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + public Option>?> ArrayArrayOfIntegerOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + public Option>?> ArrayArrayOfModelOption { get; private set; } // option d /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + public Option?> ArrayOfStringOption { get; private set; } // option d /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -120,9 +139,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? arrayArrayOfInteger = default; - List>? arrayArrayOfModel = default; - List? arrayOfString = default; + Option>?> arrayArrayOfInteger = default; + Option>?> arrayArrayOfModel = default; + Option?> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -141,15 +160,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -157,16 +176,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a } /// @@ -193,12 +212,24 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index a73515d6023b..5e1ceb0f75a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { - LengthCm = lengthCm; + LengthCmOption = lengthCm; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + public Option LengthCmOption { get; private set; } // option d + /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +136,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + return new Banana(lengthCm); // a } /// @@ -159,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index 20d095383d78..6cd37b9df16b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; - Sweet = sweet; + SweetOption = sweet; OnCreated(); } @@ -49,13 +50,19 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal LengthCm { get; set; } // d + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + public Option SweetOption { get; private set; } // option d /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -104,8 +111,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -124,11 +131,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -136,13 +143,16 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value!.Value!, sweet); // a } /// @@ -169,8 +179,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 87c83d423c17..087ab4338457 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,13 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); - return new BasquePig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value!); // a } /// @@ -158,7 +162,10 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", basquePig.ClassName); + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 53520c57a3d9..6551d591601f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,55 +41,91 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { - ATT_NAME = aTTNAME; - CapitalCamel = capitalCamel; - CapitalSnake = capitalSnake; - SCAETHFlowPoints = sCAETHFlowPoints; - SmallCamel = smallCamel; - SmallSnake = smallSnake; + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + public Option ATT_NAMEOption { get; private set; } // option d + /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + public Option CapitalCamelOption { get; private set; } // option d /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + public Option CapitalSnakeOption { get; private set; } // option d /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + public Option SCAETHFlowPointsOption { get; private set; } // option d /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + public Option SmallCamelOption { get; private set; } // option d /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + public Option SmallSnakeOption { get; private set; } // option d /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -148,12 +185,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? aTTNAME = default; - string? capitalCamel = default; - string? capitalSnake = default; - string? sCAETHFlowPoints = default; - string? smallCamel = default; - string? smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -171,22 +208,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()!); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()!); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()!); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()!); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()!); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,25 +231,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a } /// @@ -239,12 +276,41 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index 2a0960e3a903..e21a06633ffc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,19 +38,25 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { - Declawed = declawed; + DeclawedOption = declawed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + public Option DeclawedOption { get; private set; } // option d + /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -88,9 +95,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? declawed = default; - string? color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -108,14 +115,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -123,16 +130,19 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + return new Cat(className.Value!, declawed, color); // a } /// @@ -159,9 +169,19 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); // 1 + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 714575af8f4d..aac8cde4154a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,29 +34,35 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + IdOption = id; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } // d /// - /// Gets or Sets Name + /// Used to track the state of Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -71,8 +78,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -111,8 +118,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -129,12 +136,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -142,13 +149,16 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(id.Value, name); + return new Category(name.Value!, id); // a } /// @@ -175,8 +185,13 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + writer.WriteString("name", category.Name); // 1 + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index 36f89e4c7930..351b15019921 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { - Name = name; - PetType = petType; + NameOption = name; + PetTypeOption = petType; OnCreated(); } @@ -89,26 +90,37 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// /// /// - public static string PetTypeEnumToJsonValue(PetTypeEnum value) + public static string PetTypeEnumToJsonValue(PetTypeEnum? value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of PetType + /// + [JsonIgnore] + public new Option PetTypeOption { get; private set; } // option a + /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -148,8 +160,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -167,13 +179,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; case "pet_type": string? petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -181,13 +192,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + return new ChildCat(name, petType); // a } /// @@ -214,9 +225,13 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); // 1 - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 66a7dee91d88..73d76309c5ca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { - VarClass = varClass; + VarClassOption = varClass; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + return new ClassModel(varClass); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClassOption.IsSet && classModel.VarClass == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + + if (classModel.VarClassOption.IsSet) + writer.WriteString("_class", classModel.VarClass); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 01f2390005d2..2c5463a08604 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,13 +142,19 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -174,8 +181,15 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index fd9ee9d36830..0728f95344ec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,13 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); - return new DanishPig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value!); // a } /// @@ -158,7 +162,10 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", danishPig.ClassName); + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 6a9c5d4a7952..5deed266d155 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,20 +36,26 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { - DateOnlyProperty = dateOnlyProperty; + DateOnlyPropertyOption = dateOnlyProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + public Option DateOnlyPropertyOption { get; private set; } // option d + /// /// Gets or Sets DateOnlyProperty /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -108,7 +115,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -127,7 +134,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -135,10 +142,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + return new DateOnlyClass(dateOnlyProperty); // a } /// @@ -165,7 +172,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 84ebd0792c33..f3245a4e6d73 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + return new DeprecatedObject(name); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index fa2bab080244..2a56dadbab0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,23 +34,29 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { - Breed = breed; + BreedOption = breed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + public Option BreedOption { get; private set; } // option d + /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -88,9 +95,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? breed = default; - string? className = default; - string? color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -107,14 +114,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()!); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -122,16 +129,19 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(breed, className, color); + return new Dog(className.Value!, breed, color); // a } /// @@ -158,9 +168,22 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); // 1 + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); // 1 + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 8f5fff0f79a0..6a4a70997447 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,40 +39,64 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape? nullableShape = default, ShapeOrNull? shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option?> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { - MainShape = mainShape; - Shapes = shapes; - NullableShape = nullableShape; - ShapeOrNull = shapeOrNull; + MainShapeOption = mainShape; + ShapesOption = shapes; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + public Option MainShapeOption { get; private set; } // option d + /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + public Option?> ShapesOption { get; private set; } // option d /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + public Option NullableShapeOption { get; private set; } // option d /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get; set; } + public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + public Option ShapeOrNullOption { get; private set; } // option d /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get; set; } + public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -140,10 +165,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape? mainShape = default; - List? shapes = default; - NullableShape? nullableShape = default; - ShapeOrNull? shapeOrNull = default; + Option mainShape = default; + Option?> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -162,19 +187,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -182,13 +207,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a } /// @@ -215,14 +240,34 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) // 14 + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.ShapesOption.IsSet) // 14 + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index c9a92f18c9fc..cfda5d8a343c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option?> arrayEnum = default, Option justSymbol = default) { - ArrayEnum = arrayEnum; - JustSymbol = justSymbol; + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; OnCreated(); } @@ -100,9 +101,8 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// /// /// - public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) + public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum? value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -167,9 +167,8 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// /// /// - public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -179,17 +178,29 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + public Option JustSymbolOption { get; private set; } // option a + /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + public Option?> ArrayEnumOption { get; private set; } // option d /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -245,8 +256,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option?> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -265,13 +276,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "just_symbol": string? justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -279,13 +289,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + return new EnumArrays(arrayEnum, justSymbol); // a } /// @@ -312,10 +322,13 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnumOption.IsSet) // 14 + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs index 76dcba15b394..03b2780c4842 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index ac3f81f956ae..4f13dbe3902c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,32 +34,188 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { - EnumInteger = enumInteger; - EnumIntegerOnly = enumIntegerOnly; - EnumNumber = enumNumber; - EnumString = enumString; EnumStringRequired = enumStringRequired; - OuterEnumDefaultValue = outerEnumDefaultValue; - OuterEnumInteger = outerEnumInteger; - OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; - OuterEnum = outerEnum; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OuterEnumOption = outerEnum; OnCreated(); } partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + /// /// Defines EnumInteger /// @@ -118,11 +275,17 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) return (int) value; } + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + public Option EnumIntegerOption { get; private set; } // option a + /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a /// /// Defines EnumIntegerOnly @@ -183,11 +346,17 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) return (int) value; } + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + public Option EnumIntegerOnlyOption { get; private set; } // option a + /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a /// /// Defines EnumNumber @@ -244,9 +413,8 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// /// /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) { - if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -256,11 +424,17 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + public Option EnumNumberOption { get; private set; } // option a + /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a /// /// Defines EnumString @@ -383,9 +557,8 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// /// /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) { - if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -414,191 +587,64 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) } /// - /// Gets or Sets EnumString + /// Used to track the state of EnumString /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + [JsonIgnore] + public Option EnumStringOption { get; private set; } // option a /// - /// Defines EnumStringRequired + /// Gets or Sets EnumString /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a /// - /// Returns a + /// Used to track the state of OuterEnumDefaultValue /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumDefaultValueOption { get; private set; } // option a /// - /// Returns a + /// Gets or Sets OuterEnumDefaultValue /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a /// - /// Converts the to the json value + /// Used to track the state of OuterEnumInteger /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumIntegerOption { get; private set; } // option a /// - /// Gets or Sets EnumStringRequired + /// Gets or Sets OuterEnumInteger /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a /// - /// Gets or Sets OuterEnumDefaultValue + /// Used to track the state of OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a /// - /// Gets or Sets OuterEnumInteger + /// Gets or Sets OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a /// - /// Gets or Sets OuterEnumIntegerDefaultValue + /// Used to track the state of OuterEnum /// - [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumOption { get; private set; } // option a /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -614,11 +660,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -661,15 +707,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -686,53 +732,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string? enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string? enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string? enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string? outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string? outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string? outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -740,31 +780,34 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a } /// @@ -791,44 +834,50 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - else - writer.WriteNull("outerEnumDefaultValue"); + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else + writer.WriteNull("enum_string"); + + if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) // 10 { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnumOption.IsSet) // 10 + if (enumTest.OuterEnumOption!.Value != null) // 10 a + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 717de0e356f4..c1e1e3ab819e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,13 +142,19 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -174,8 +181,15 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index f0e27f10fa32..01af1a7a0881 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,20 +36,26 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { - SourceURI = sourceURI; + SourceURIOption = sourceURI; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + public Option SourceURIOption { get; private set; } // option d + /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -103,7 +110,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -129,10 +136,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + return new File(sourceURI); // a } /// @@ -159,7 +166,11 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index da341a59421b..b1bf76695699 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option?> files = default) { - File = file; - Files = files; + FileOption = file; + FilesOption = files; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of File + /// + [JsonIgnore] + public Option FileOption { get; private set; } // option d + /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + public Option?> FilesOption { get; private set; } // option d /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File? file = default; - List? files = default; + Option file = default; + Option?> files = default; while (utf8JsonReader.Read()) { @@ -131,11 +144,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -143,13 +156,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + return new FileSchemaTestClass(file, files); // a } /// @@ -176,10 +189,18 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) // 14 + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.FilesOption.IsSet) // 14 + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index 3628416eb0d0..cccd77933ba9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { - Bar = bar; + BarOption = bar; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; private set; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + return new Foo(bar); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 6f2670034f24..7477772acb05 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { - VarString = varString; + VarStringOption = varString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d + /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo? varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,10 +136,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + return new FooGetDefaultResponse(varString); // a } /// @@ -159,8 +166,12 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 9066cc903b6a..2d95559224b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,9 +34,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -43,8 +46,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -53,151 +54,241 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; - DateTime = dateTime; - VarDecimal = varDecimal; - VarDouble = varDouble; - VarFloat = varFloat; - Int32 = int32; - Int64 = int64; - Integer = integer; Number = number; Password = password; - PatternWithBackslash = patternWithBackslash; - PatternWithDigits = patternWithDigits; - PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; - VarString = varString; - UnsignedInteger = unsignedInteger; - UnsignedLong = unsignedLong; - Uuid = uuid; + BinaryOption = binary; + DateTimeOption = dateTime; + VarDecimalOption = varDecimal; + VarDoubleOption = varDouble; + VarFloatOption = varFloat; + Int32Option = int32; + Int64Option = int64; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + VarStringOption = varString; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } + public byte[] VarByte { get; set; } // d /// /// Gets or Sets Date /// /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } + public DateTime Date { get; set; } // d + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } // d + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } // d + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + public Option BinaryOption { get; private set; } // option d + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of VarDecimal + /// + [JsonIgnore] + public Option VarDecimalOption { get; private set; } // option d /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + + /// + /// Used to track the state of VarDouble + /// + [JsonIgnore] + public Option VarDoubleOption { get; private set; } // option d /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + + /// + /// Used to track the state of VarFloat + /// + [JsonIgnore] + public Option VarFloatOption { get; private set; } // option d /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + public Option Int32Option { get; private set; } // option d /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + public Option Int64Option { get; private set; } // option d /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d /// - /// Gets or Sets Integer + /// Used to track the state of Integer /// - [JsonPropertyName("integer")] - public int Integer { get; set; } + [JsonIgnore] + public Option IntegerOption { get; private set; } // option d /// - /// Gets or Sets Number + /// Gets or Sets Integer /// - [JsonPropertyName("number")] - public decimal Number { get; set; } + [JsonPropertyName("integer")] + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d /// - /// Gets or Sets Password + /// Used to track the state of PatternWithBackslash /// - [JsonPropertyName("password")] - public string Password { get; set; } + [JsonIgnore] + public Option PatternWithBackslashOption { get; private set; } // option d /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + public Option PatternWithDigitsOption { get; private set; } // option d /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + public Option UnsignedIntegerOption { get; private set; } // option d /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + public Option UnsignedLongOption { get; private set; } // option d /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -213,9 +304,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -223,8 +316,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -244,122 +335,126 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslashOption.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigitsOption.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarStringOption.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + + if (this.VarStringOption.Value != null &&!regexVarString.Match(this.VarStringOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -400,25 +495,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream? binary = default; - byte[]? varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string? password = default; - string? patternWithBackslash = default; - string? patternWithDigits = default; - string? patternWithDigitsAndDelimiter = default; - string? varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -435,76 +530,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()!); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()!); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()!); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()!); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -512,64 +607,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - if (varByte == null) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - if (date == null) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a } /// @@ -596,28 +703,79 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarStringOption.IsSet && formatTest.VarString == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + + writer.WriteNumber("number", formatTest.Number); // 3 + + writer.WriteString("password", formatTest.Password); // 1 + + if (formatTest.BinaryOption.IsSet) // 14 + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (formatTest.VarDecimalOption.IsSet) // 14 + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDoubleOption.IsSet) + writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + + if (formatTest.VarFloatOption.IsSet) + writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + + if (formatTest.VarStringOption.IsSet) + writer.WriteString("string", formatTest.VarString); // 1 + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index c3e213f48a47..167d7de7e4c7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,10 +36,10 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; - Color = color; + ColorOption = color; OnCreated(); } @@ -47,10 +48,10 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; - Color = color; + ColorOption = color; OnCreated(); } @@ -66,11 +67,17 @@ public Fruit(Banana banana, string color) /// public Banana? Banana { get; set; } + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d + /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -118,7 +125,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -158,7 +165,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -166,14 +173,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, color); // b if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, color); // b throw new JsonException(); } @@ -202,7 +209,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs index 56212b9c18dd..5db54ec72e55 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -151,10 +152,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); + return new FruitReq(appleReq); // b if (bananaReq != null) - return new FruitReq(bananaReq); + return new FruitReq(bananaReq); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 9ed8b2db2d15..0e98ab79c33c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,31 +37,49 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple? apple, Banana? banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { - Apple = apple; - Banana = banana; - Color = color; + AppleOption = apple; + BananaOption = banana; + ColorOption = color; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + public Option AppleOption { get; private set; } // option b + /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + public Option BananaOption { get; private set; } // option b /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -108,7 +127,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -148,7 +167,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -156,10 +175,17 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); // a } /// @@ -173,16 +199,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.AppleOption.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.BananaOption.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -198,7 +224,11 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index cb7fe43f91cb..98443b63f39f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } + public string PetType { get; set; } // d /// /// Gets or Sets additional properties @@ -112,7 +113,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -130,7 +131,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -138,10 +139,13 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); - return new GrandparentAnimal(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(petType.Value!); // a } /// @@ -168,7 +172,10 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", grandparentAnimal.PetType); + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + + writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 3b8c651908c8..5e021cb539ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatabl /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { - Bar = bar; - Foo = foo; + BarOption = bar; + FooOption = foo; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string? Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + public Option FooOption { get; } // option d /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public string? Foo { get { return this. FooOption; } } // d /// /// Gets or Sets additional properties @@ -107,8 +120,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); - hashCode = (hashCode * 59) + Foo.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -148,8 +165,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -167,10 +184,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -178,13 +195,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + return new HasOnlyReadOnly(bar, foo); // a } /// @@ -211,8 +228,17 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index ccdc21a06856..8f20110d9ab1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string? nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { - NullableMessage = nullableMessage; + NullableMessageOption = nullableMessage; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + public Option NullableMessageOption { get; private set; } // option d + /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get; set; } + public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -128,7 +135,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); + return new HealthCheckResult(nullableMessage); // a } /// @@ -155,7 +162,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f33f99e6dfbf..79ae3c0e5e1c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Returns the string presentation of the object @@ -104,8 +105,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -123,10 +124,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -134,13 +135,19 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -167,8 +174,15 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index 8f55db6ee70d..edadd4f0d93d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { - Var123List = var123List; + Var123ListOption = var123List; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + public Option Var123ListOption { get; private set; } // option d + /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + return new List(var123List); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8253e7ac7bc8..fd7a07b034a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { - EscapedLiteralString = escapedLiteralString; - UnescapedLiteralString = unescapedLiteralString; + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + public Option EscapedLiteralStringOption { get; private set; } // option d + /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + public Option UnescapedLiteralStringOption { get; private set; } // option d /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? escapedLiteralString = default; - string? unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -130,10 +143,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()!); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,13 +154,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a } /// @@ -174,8 +187,17 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index 0910cbbb0a17..f95eca9e5523 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -87,7 +88,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -152,7 +153,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; Pig? pig = null; Whale? whale = null; @@ -209,7 +210,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -217,17 +218,20 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, className.Value!); // c if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, className.Value!); // c if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, className.Value!); // c throw new JsonException(); } @@ -271,7 +275,10 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", mammal.ClassName); + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + + writer.WriteString("className", mammal.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index e5442a41c590..c0e340a4d4df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,12 +39,12 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option?> directMap = default, Option?> indirectMap = default, Option>?> mapMapOfString = default, Option?> mapOfEnumString = default) { - DirectMap = directMap; - IndirectMap = indirectMap; - MapMapOfString = mapMapOfString; - MapOfEnumString = mapOfEnumString; + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; OnCreated(); } @@ -104,9 +105,8 @@ public static InnerEnum InnerEnumFromString(string value) /// /// /// - public static string InnerEnumToJsonValue(InnerEnum value) + public static string InnerEnumToJsonValue(InnerEnum? value) { - if (value == InnerEnum.UPPER) return "UPPER"; @@ -116,29 +116,53 @@ public static string InnerEnumToJsonValue(InnerEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + public Option?> DirectMapOption { get; private set; } // option d + /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + public Option?> IndirectMapOption { get; private set; } // option d /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + public Option>?> MapMapOfStringOption { get; private set; } // option d /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + public Option?> MapOfEnumStringOption { get; private set; } // option d /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -196,10 +220,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary? directMap = default; - Dictionary? indirectMap = default; - Dictionary>? mapMapOfString = default; - Dictionary? mapOfEnumString = default; + Option?> directMap = default; + Option?> indirectMap = default; + Option>?> mapMapOfString = default; + Option?> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -218,19 +242,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -238,19 +262,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a } /// @@ -277,14 +301,30 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) // 14 + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMapOption.IsSet) // 14 + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfStringOption.IsSet) // 14 + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumStringOption.IsSet) // 14 + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2ea2d79b05d2..f9e442fece06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,40 +39,64 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option?> map = default, Option uuid = default, Option uuidWithPattern = default) { - DateTime = dateTime; - Map = map; - Uuid = uuid; - UuidWithPattern = uuidWithPattern; + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d + /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + public Option?> MapOption { get; private set; } // option d /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + public Option UuidWithPatternOption { get; private set; } // option d /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -105,7 +130,8 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -140,10 +166,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary? map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option?> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -162,19 +188,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -182,19 +208,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a } /// @@ -221,11 +247,20 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index b017d0715831..888ecd59ce95 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { - VarClass = varClass; - Name = name; + VarClassOption = varClass; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -130,11 +143,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()!); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -142,13 +155,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + return new Model200Response(varClass, name); // a } /// @@ -175,8 +188,14 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClassOption.IsSet && model200Response.VarClass == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + + if (model200Response.VarClassOption.IsSet) + writer.WriteString("class", model200Response.VarClass); // 1 + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 1883e1d09c88..a94f395236c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { - VarClient = varClient; + VarClientOption = varClient; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + public Option VarClientOption { get; private set; } // option d + /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + return new ModelClient(varClient); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 83161d26894d..daabbe58b6c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,12 +39,12 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; - Property = property; - SnakeCase = snakeCase; - Var123Number = var123Number; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; OnCreated(); } @@ -53,25 +54,43 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } + public int VarName { get; set; } // d + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + public Option PropertyOption { get; private set; } // option d /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + public Option SnakeCaseOption { get; } // option d /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + public Option Var123NumberOption { get; } // option d /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public int? Var123Number { get { return this. Var123NumberOption; } } // d /// /// Gets or Sets additional properties @@ -125,8 +144,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); - hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -166,10 +189,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string? property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -188,18 +211,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()!); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -207,19 +230,22 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a } /// @@ -246,10 +272,19 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); // 3 + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); // 1 + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 23f7775d8909..61f336825040 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } + public List> AObjVariableobject { get; set; } // d /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } + public int PkiNotificationtestID { get; set; } // d /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List>? aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>?> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -131,11 +132,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>?>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -143,13 +144,19 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); - if (pkiNotificationtestID == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a } /// @@ -176,9 +183,12 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 916746334975..3b43f4fb1619 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -46,96 +47,168 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List? arrayAndItemsNullableProp = default, List? arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary? objectAndItemsNullableProp = default, Dictionary? objectNullableProp = default, string? stringProp = default) : base() + public NullableClass(Option?> arrayItemsNullable = default, Option?> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullable = arrayItemsNullable; - ObjectItemsNullable = objectItemsNullable; - ArrayAndItemsNullableProp = arrayAndItemsNullableProp; - ArrayNullableProp = arrayNullableProp; - BooleanProp = booleanProp; - DateProp = dateProp; - DatetimeProp = datetimeProp; - IntegerProp = integerProp; - NumberProp = numberProp; - ObjectAndItemsNullableProp = objectAndItemsNullableProp; - ObjectNullableProp = objectNullableProp; - StringProp = stringProp; + ArrayItemsNullableOption = arrayItemsNullable; + ObjectItemsNullableOption = objectItemsNullable; + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + public Option?> ArrayItemsNullableOption { get; private set; } // option d + /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + public Option?> ObjectItemsNullableOption { get; private set; } // option d /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + public Option?> ArrayAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get; set; } + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + public Option?> ArrayNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get; set; } + public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + public Option BooleanPropOption { get; private set; } // option d /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + public Option DatePropOption { get; private set; } // option d /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + public Option DatetimePropOption { get; private set; } // option d /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + public Option IntegerPropOption { get; private set; } // option d /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + public Option NumberPropOption { get; private set; } // option d /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + public Option?> ObjectAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get; set; } + public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + public Option?> ObjectNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get; set; } + public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + public Option StringPropOption { get; private set; } // option d /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get; set; } + public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -222,18 +295,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? arrayItemsNullable = default; - Dictionary? objectItemsNullable = default; - List? arrayAndItemsNullableProp = default; - List? arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary? objectAndItemsNullableProp = default; - Dictionary? objectNullableProp = default; - string? stringProp = default; + Option?> arrayItemsNullable = default; + Option?> objectItemsNullable = default; + Option?> arrayAndItemsNullableProp = default; + Option?> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option?> objectAndItemsNullableProp = default; + Option?> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -252,50 +325,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -303,13 +376,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a } /// @@ -336,45 +409,85 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); // 1 + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index b5d1bc4e4200..5a05b18cf2f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,20 +36,26 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { - Uuid = uuid; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d + /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -103,7 +110,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -122,7 +129,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -130,7 +137,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); + return new NullableGuidClass(uuid); // a } /// @@ -157,11 +164,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index c6f4dea35852..5946a3a86c89 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -70,7 +71,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -135,7 +136,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,14 +195,17 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -240,7 +244,10 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", nullableShape.ShapeType); + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + + writer.WriteString("shapeType", nullableShape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index 3e05a1954548..bc60bde31ce5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { - JustNumber = justNumber; + JustNumberOption = justNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + public Option JustNumberOption { get; private set; } // option d + /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +136,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + return new NumberOnly(justNumber); // a } /// @@ -159,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 84957dfb4699..4c1790a874b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,43 +39,67 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option?> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { - Bars = bars; - DeprecatedRef = deprecatedRef; - Id = id; - Uuid = uuid; + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + public Option?> BarsOption { get; private set; } // option d + /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + public Option DeprecatedRefOption { get; private set; } // option d /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -132,10 +157,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? bars = default; - DeprecatedObject? deprecatedRef = default; - decimal? id = default; - string? uuid = default; + Option?> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -154,18 +179,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -173,19 +198,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a } /// @@ -212,12 +237,26 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs index e84b8aae250e..431635c1feb2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -123,10 +124,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 4fc1f5cccf39..bbd856716485 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,14 +41,14 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { - Id = id; - PetId = petId; - Quantity = quantity; - ShipDate = shipDate; - Status = status; - Complete = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + CompleteOption = complete; OnCreated(); } @@ -120,9 +121,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Placed) return "placed"; @@ -135,43 +135,79 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + public Option PetIdOption { get; private set; } // option d /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + public Option QuantityOption { get; private set; } // option d /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + public Option ShipDateOption { get; private set; } // option d /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + public Option CompleteOption { get; private set; } // option d /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -236,12 +272,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -260,29 +296,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -290,25 +325,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + return new Order(id, petId, quantity, shipDate, status, complete); // a } /// @@ -335,18 +370,26 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 944b48cec72f..cd9235a8e800 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,33 +38,51 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { - MyBoolean = myBoolean; - MyNumber = myNumber; - MyString = myString; + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + public Option MyBooleanOption { get; private set; } // option d + /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + public Option MyNumberOption { get; private set; } // option d /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + public Option MyStringOption { get; private set; } // option d /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -120,9 +139,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string? myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -141,14 +160,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -156,16 +175,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + return new OuterComposite(myBoolean, myNumber, myString); // a } /// @@ -192,9 +211,17 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs index 01f4f4676274..96af6f3670d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7903c8296487..a50d5c056ecc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index a09978af1c35..41ecebcf8f5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 4a73f8886ac8..902dbb066392 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 9a549df1f0aa..03a8ccdecacd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index 73fc6e3e5ede..ff6c5ba92473 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -78,7 +79,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -96,7 +97,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -104,10 +105,13 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); - return new ParentPet(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(petType.Value!); // a } /// @@ -134,7 +138,10 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", parentPet.PetType); + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + + writer.WriteString("pet_type", parentPet.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 1754664e96da..639017a1f196 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,21 +34,21 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option?> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; - Status = status; - Tags = tags; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; OnCreated(); } @@ -120,9 +121,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Available) return "available"; @@ -135,43 +135,67 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Gets or Sets Name + /// + /// doggie + [JsonPropertyName("name")] + public string Name { get; set; } // d + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } // d + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + public Option CategoryOption { get; private set; } // option d /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get; set; } + public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d /// - /// Gets or Sets Id + /// Used to track the state of Id /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// - /// Gets or Sets Name + /// Gets or Sets Id /// - /// doggie - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// - /// Gets or Sets PhotoUrls + /// Used to track the state of Tags /// - [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } + [JsonIgnore] + public Option?> TagsOption { get; private set; } // option d /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -187,10 +211,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -231,12 +255,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category? category = default; - long? id = default; - string? name = default; - List? photoUrls = default; - Pet.StatusEnum? status = default; - List? tags = default; + Option name = default; + Option?> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option?> tags = default; while (utf8JsonReader.Read()) { @@ -253,30 +277,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()!); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string? statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -284,25 +307,31 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); - if (photoUrls == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a } /// @@ -329,21 +358,37 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); // 1 + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 + if (pet.CategoryOption.IsSet) // 14 + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.TagsOption.IsSet) // 14 + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index 07ecf267e656..c426e2e92f11 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -70,7 +71,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -135,7 +136,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; + Option className = default; BasquePig? basquePig = null; DanishPig? danishPig = null; @@ -186,7 +187,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,14 +195,17 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, className.Value!); // c if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, className.Value!); // c throw new JsonException(); } @@ -240,7 +244,10 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", pig.ClassName); + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + + writer.WriteString("className", pig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 2093843c8d9e..ec8a8a92cbb1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -196,16 +197,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); + return new PolymorphicProperty(varBool); // b if (varString != null) - return new PolymorphicProperty(varString); + return new PolymorphicProperty(varString); // b if (varObject != null) - return new PolymorphicProperty(varObject); + return new PolymorphicProperty(varObject); // b if (list != null) - return new PolymorphicProperty(list); + return new PolymorphicProperty(list); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index 2ac725986a2a..c00c8c241f0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -70,7 +71,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -135,7 +136,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral? complexQuadrilateral = null; SimpleQuadrilateral? simpleQuadrilateral = null; @@ -186,7 +187,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,14 +195,17 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c throw new JsonException(); } @@ -240,7 +244,10 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index a0be19661249..4c00c08e2e7c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,13 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value!); // a } /// @@ -158,7 +162,10 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 7dae6b8bb181..38d53b80b444 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObj /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { - Bar = bar; - Baz = baz; + BarOption = bar; + BazOption = baz; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string? Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + public Option BazOption { get; private set; } // option d /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -107,7 +120,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -147,8 +162,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? bar = default; - string? baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -166,10 +181,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()!); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -177,13 +192,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + return new ReadOnlyFirst(bar, baz); // a } /// @@ -210,8 +225,17 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); // 1 + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..e9dbe252e471 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2364 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +#nullable enable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string? NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } // d + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } // d + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + public Option NotrequiredNullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option?> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option?> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string? localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)!); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string? requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string? requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string? requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string? requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string? notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string? notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + + if (requiredClass.RequiredNullableArrayOfString != null) // 12 + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + else + writer.WriteNull("required_nullable_uuid"); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index 262ecadf740b..1d5654053d85 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { - VarReturn = varReturn; + VarReturnOption = varReturn; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + public Option VarReturnOption { get; private set; } // option d + /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -129,10 +136,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + return new Return(varReturn); // a } /// @@ -159,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index f7be23ecece4..b0eb391cbe3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { - Role = role; - RoleUuid = roleUuid; + RoleOption = role; + RoleUuidOption = roleUuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Role + /// + [JsonIgnore] + public Option RoleOption { get; private set; } // option d + /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + public Option RoleUuidOption { get; private set; } // option d /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole? role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -131,11 +144,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -143,13 +156,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + return new RolesReportsHash(role, roleUuid); // a } /// @@ -176,9 +189,14 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) // 14 + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index f64e8c9cd62e..6dde1d4a12a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + return new RolesReportsHashRole(name); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 9e9dc21151e0..864b36a500ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; - string? triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,13 +142,19 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -174,8 +181,15 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index d8fbc094d19c..d8f653dd1b1b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -70,7 +71,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -135,7 +136,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,14 +195,17 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -240,7 +244,10 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shape.ShapeType); + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + + writer.WriteString("shapeType", shape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 1b0a8291f383..339f2a8e9aea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,13 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); - return new ShapeInterface(shapeType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value!); // a } /// @@ -158,7 +162,10 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeInterface.ShapeType); + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 1b75eada511b..561d71d64982 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -70,7 +71,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -135,7 +136,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? shapeType = default; + Option shapeType = default; Quadrilateral? quadrilateral = null; Triangle? triangle = null; @@ -186,7 +187,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -194,14 +195,17 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -240,7 +244,10 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeOrNull.ShapeType); + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + + writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 8945a243dfd2..093dfadef92a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -49,13 +50,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -111,8 +112,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? quadrilateralType = default; - string? shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -130,10 +131,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()!); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -141,13 +142,19 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -174,8 +181,15 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index 39baf9d3e4f0..c21058c299bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { - VarSpecialModelName = varSpecialModelName; - SpecialPropertyName = specialPropertyName; + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + public Option VarSpecialModelNameOption { get; private set; } // option d + /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + public Option SpecialPropertyNameOption { get; private set; } // option d /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -130,11 +143,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()!); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -142,13 +155,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + return new SpecialModelName(varSpecialModelName, specialPropertyName); // a } /// @@ -175,8 +188,14 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index 1f69557e7d73..6848c075604a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,26 +37,38 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { - Id = id; - Name = name; + IdOption = id; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d + /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,8 +124,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string? name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -131,10 +144,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -142,13 +155,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + return new Tag(id, name); // a } /// @@ -175,8 +188,14 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index fa286e8f3fd6..bbf3a175c3be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { - Value = value; + ValueOption = value; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Value + /// + [JsonIgnore] + public Option ValueOption { get; private set; } // option d + /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + return new TestCollectionEndingWithWordList(value); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5c481470c71a..7daab5244c2e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option?> testCollectionEndingWithWordList = default) { - TestCollectionEndingWithWordList = testCollectionEndingWithWordList; + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + public Option?> TestCollectionEndingWithWordListOption { get; private set; } // option d + /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? testCollectionEndingWithWordList = default; + Option?> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; default: break; @@ -129,10 +136,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a } /// @@ -159,8 +166,12 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 95ad0601f978..d22ed876096d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { - SomeProperty = someProperty; + SomePropertyOption = someProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + public Option SomePropertyOption { get; private set; } // option d + /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -113,7 +120,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -131,7 +138,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -139,10 +146,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a } /// @@ -169,7 +176,11 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index c75c83f7d54b..760b3ae0b750 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -87,7 +88,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -152,7 +153,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; EquilateralTriangle? equilateralTriangle = null; IsoscelesTriangle? isoscelesTriangle = null; @@ -209,7 +210,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -217,17 +218,20 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleType.Value!); // c if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleType.Value!); // c if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleType.Value!); // c throw new JsonException(); } @@ -271,7 +275,10 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangle.TriangleType); + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + + writer.WriteString("triangleType", triangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index a724643f7327..c5c33c6a0fad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,7 +48,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -102,7 +103,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -120,7 +121,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +129,13 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); - return new TriangleInterface(triangleType); + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value!); // a } /// @@ -158,7 +162,10 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangleInterface.TriangleType); + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 32df8b267426..757cda5bf483 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -46,101 +47,173 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object? anyTypeProp = default, Object? anyTypePropNullable = default, Object? objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { - Email = email; - FirstName = firstName; - Id = id; - LastName = lastName; - ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; - Password = password; - Phone = phone; - UserStatus = userStatus; - Username = username; - AnyTypeProp = anyTypeProp; - AnyTypePropNullable = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Email + /// + [JsonIgnore] + public Option EmailOption { get; private set; } // option d + /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + public Option FirstNameOption { get; private set; } // option d /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + public Option LastNameOption { get; private set; } // option d /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + public Option PasswordOption { get; private set; } // option d /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + public Option PhoneOption { get; private set; } // option d /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + public Option UserStatusOption { get; private set; } // option d /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + public Option UsernameOption { get; private set; } // option d /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + public Option AnyTypePropOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get; set; } + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + public Option AnyTypePropNullableOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get; set; } + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get; set; } + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -206,18 +279,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? email = default; - string? firstName = default; - long? id = default; - string? lastName = default; - Object? objectWithNoDeclaredProps = default; - string? password = default; - string? phone = default; - int? userStatus = default; - string? username = default; - Object? anyTypeProp = default; - Object? anyTypePropNullable = default; - Object? objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -235,46 +308,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()!); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()!); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()!); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -282,34 +355,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a } /// @@ -336,22 +409,78 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); // 1 + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); // 1 + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); // 1 + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); // 1 + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); // 1 + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); // 1 + + if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 59099f90e2de..2d09d1129846 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,11 +38,11 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; - HasBaleen = hasBaleen; - HasTeeth = hasTeeth; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; OnCreated(); } @@ -51,19 +52,31 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + public Option HasBaleenOption { get; private set; } // option d /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + public Option HasTeethOption { get; private set; } // option d /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -120,9 +133,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -140,15 +153,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -156,16 +169,19 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + return new Whale(className.Value!, hasBaleen, hasTeeth); // a } /// @@ -192,9 +208,16 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); // 1 + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index f3a1c274ec5f..a3c13825b133 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,10 +37,10 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; - Type = type; + TypeOption = type; OnCreated(); } @@ -111,9 +112,8 @@ public static TypeEnum TypeEnumFromString(string value) /// /// /// - public static string TypeEnumToJsonValue(TypeEnum value) + public static string TypeEnumToJsonValue(TypeEnum? value) { - if (value == TypeEnum.Plains) return "plains"; @@ -126,17 +126,23 @@ public static string TypeEnumToJsonValue(TypeEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option a + /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -203,8 +209,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -222,13 +228,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()!); break; case "type": string? typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -236,13 +241,16 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + return new Zebra(className.Value!, type); // a } /// @@ -269,9 +277,12 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); // 1 - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 60223b9ff74f..1db14d35a9e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 27d16e96c2b3..dd8263762e14 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,9 +36,9 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { - ZeroBasedEnum = zeroBasedEnum; + ZeroBasedEnumOption = zeroBasedEnum; OnCreated(); } @@ -98,9 +99,8 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// /// /// - public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -110,11 +110,17 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + public Option ZeroBasedEnumOption { get; private set; } // option a + /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -169,7 +175,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -188,9 +194,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string? zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -198,10 +203,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + return new ZeroBasedEnumClass(zeroBasedEnum); // a } /// @@ -228,8 +233,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..6e8958b1b749 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index e88b5ed621ad..f6e2fb899672 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -141,6 +141,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -149,8 +151,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,6 +167,30 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 5ea9415eba07..0cd32640adfe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,6 +114,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs index 70f41078bb68..8cf79a713b74 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,5 +35,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 42747dee35ea..7e98807f5003 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs = default) { - ActivityOutputs = activityOutputs; + ActivityOutputsOption = activityOutputs; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + public Option>> ActivityOutputsOption { get; private set; } // option d + /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary> activityOutputs = default; + Option>> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + return new Activity(activityOutputs); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) // 14 + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 233d362f51ed..03491596e433 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { - Prop1 = prop1; - Prop2 = prop2; + Prop1Option = prop1; + Prop2Option = prop2; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + public Option Prop1Option { get; private set; } // option d + /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + public Option Prop2Option { get; private set; } // option d /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string prop1 = default; - Object prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -140,13 +153,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + return new ActivityOutputElementRepresentation(prop1, prop2); // a } /// @@ -173,9 +186,18 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + + if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ed15d711b7a7..4a31df84037e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,69 +41,117 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { - EmptyMap = emptyMap; - MapOfMapProperty = mapOfMapProperty; - MapProperty = mapProperty; - MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; - MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; - MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; - MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; - Anytype1 = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + Anytype1Option = anytype1; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + public Option EmptyMapOption { get; private set; } // option d + /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + public Option>> MapOfMapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + public Option> MapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + public Option Anytype1Option { get; private set; } // option d /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get; set; } + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d /// /// Gets or Sets additional properties @@ -164,14 +213,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object emptyMap = default; - Dictionary> mapOfMapProperty = default; - Dictionary mapProperty = default; - Object mapWithUndeclaredPropertiesAnytype1 = default; - Object mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary mapWithUndeclaredPropertiesString = default; - Object anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -190,35 +239,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -226,28 +275,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a } /// @@ -274,22 +323,56 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 460543ebf0df..9db2adcbc81b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; - Color = color; + ColorOption = color; OnCreated(); } @@ -47,13 +48,19 @@ public Animal(string className, string color = @"red") /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -119,8 +126,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - string color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -138,10 +145,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -149,13 +156,16 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className, color); + return new Animal(className.Value!, color); // a } /// @@ -182,8 +192,16 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); // 1 + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a7be95495cc..b08f81ab4cae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { - Code = code; - Message = message; - Type = type; + CodeOption = code; + MessageOption = message; + TypeOption = type; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Code + /// + [JsonIgnore] + public Option CodeOption { get; private set; } // option d + /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + public Option MessageOption { get; private set; } // option d /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public string Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option d /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public string Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string message = default; - string type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -139,13 +158,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,16 +172,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + return new ApiResponse(code, message, type); // a } /// @@ -189,9 +208,20 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); // 1 + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 31246df0422a..3262ebdc682d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { - ColorCode = colorCode; - Cultivar = cultivar; - Origin = origin; + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + public Option ColorCodeOption { get; private set; } // option d + /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + public Option CultivarOption { get; private set; } // option d /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + public Option OriginOption { get; private set; } // option d /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public string Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -92,28 +111,31 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCodeOption.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.CultivarOption.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.OriginOption.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -145,9 +167,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string colorCode = default; - string cultivar = default; - string origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -165,13 +187,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()); break; default: break; @@ -179,16 +201,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + return new Apple(colorCode, cultivar, origin); // a } /// @@ -215,9 +237,23 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); // 1 + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); // 1 + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index e0882d925c5d..7d5db4a1a503 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; - Mealy = mealy; + MealyOption = mealy; OnCreated(); } @@ -47,13 +48,19 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get; set; } // d + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + public Option MealyOption { get; private set; } // option d /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -102,8 +109,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -121,11 +128,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -133,13 +140,16 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value!, mealy); // a } /// @@ -166,8 +176,13 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); // 1 + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6fc0afdbc300..2705524a85cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { - ArrayArrayNumber = arrayArrayNumber; + ArrayArrayNumberOption = arrayArrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + public Option>> ArrayArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayNumber = default; + Option>> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 0715a3fdf65f..ea924dc384f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { - ArrayNumber = arrayNumber; + ArrayNumberOption = arrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + public Option> ArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayNumber = default; + Option> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + return new ArrayOfNumberOnly(arrayNumber); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 43088ca1d97b..d7b0eef4ae79 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { - ArrayArrayOfInteger = arrayArrayOfInteger; - ArrayArrayOfModel = arrayArrayOfModel; - ArrayOfString = arrayOfString; + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + public Option>> ArrayArrayOfIntegerOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + public Option>> ArrayArrayOfModelOption { get; private set; } // option d /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + public Option> ArrayOfStringOption { get; private set; } // option d /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayOfInteger = default; - List> arrayArrayOfModel = default; - List arrayOfString = default; + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -139,15 +158,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -155,16 +174,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a } /// @@ -191,12 +210,24 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index 75bab7a8d056..6b08db748029 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { - LengthCm = lengthCm; + LengthCmOption = lengthCm; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + public Option LengthCmOption { get; private set; } // option d + /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +134,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + return new Banana(lengthCm); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 61e5cf312cca..f2c057edfca2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; - Sweet = sweet; + SweetOption = sweet; OnCreated(); } @@ -47,13 +48,19 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal LengthCm { get; set; } // d + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + public Option SweetOption { get; private set; } // option d /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -102,8 +109,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -122,11 +129,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -134,13 +141,16 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value!.Value!, sweet); // a } /// @@ -167,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index c9e4a8bc7120..44636fd4260b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); - return new BasquePig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value!); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", basquePig.ClassName); + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index ca7eb413c65b..f38b28e930a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,55 +39,91 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { - ATT_NAME = aTTNAME; - CapitalCamel = capitalCamel; - CapitalSnake = capitalSnake; - SCAETHFlowPoints = sCAETHFlowPoints; - SmallCamel = smallCamel; - SmallSnake = smallSnake; + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + public Option ATT_NAMEOption { get; private set; } // option d + /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + public Option CapitalCamelOption { get; private set; } // option d /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + public Option CapitalSnakeOption { get; private set; } // option d /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + public Option SCAETHFlowPointsOption { get; private set; } // option d /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + public Option SmallCamelOption { get; private set; } // option d /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + public Option SmallSnakeOption { get; private set; } // option d /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -146,12 +183,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string aTTNAME = default; - string capitalCamel = default; - string capitalSnake = default; - string sCAETHFlowPoints = default; - string smallCamel = default; - string smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -169,22 +206,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,25 +229,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a } /// @@ -237,12 +274,41 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 619fc52ce11c..129a67d07531 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { - Declawed = declawed; + DeclawedOption = declawed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + public Option DeclawedOption { get; private set; } // option d + /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -86,9 +93,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? declawed = default; - string color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -106,14 +113,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -121,16 +128,19 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + return new Cat(className.Value!, declawed, color); // a } /// @@ -157,9 +167,19 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); // 1 + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 6139c3048390..6c48c0199725 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,29 +32,35 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + IdOption = id; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } // d /// - /// Gets or Sets Name + /// Used to track the state of Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -69,8 +76,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -109,8 +116,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -127,12 +134,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +147,16 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(id.Value, name); + return new Category(name.Value!, id); // a } /// @@ -173,8 +183,13 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + writer.WriteString("name", category.Name); // 1 + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index a32821259868..db2c93fe72f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { - Name = name; - PetType = petType; + NameOption = name; + PetTypeOption = petType; OnCreated(); } @@ -87,26 +88,37 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// /// /// - public static string PetTypeEnumToJsonValue(PetTypeEnum value) + public static string PetTypeEnumToJsonValue(PetTypeEnum? value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of PetType + /// + [JsonIgnore] + public new Option PetTypeOption { get; private set; } // option a + /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -146,8 +158,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -165,13 +177,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -179,13 +190,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + return new ChildCat(name, petType); // a } /// @@ -212,9 +223,13 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); // 1 - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index d1c65d368199..8213ddd10f02 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { - VarClass = varClass; + VarClassOption = varClass; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + return new ClassModel(varClass); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClassOption.IsSet && classModel.VarClass == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + + if (classModel.VarClassOption.IsSet) + writer.WriteString("_class", classModel.VarClass); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 79579247f7e9..1d0c9f3fd5e6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 84439210bcfc..5881871fdc04 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); - return new DanishPig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value!); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", danishPig.ClassName); + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 4420630af349..0a3e1fda586d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { - DateOnlyProperty = dateOnlyProperty; + DateOnlyPropertyOption = dateOnlyProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + public Option DateOnlyPropertyOption { get; private set; } // option d + /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -106,7 +113,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -125,7 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -133,10 +140,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + return new DateOnlyClass(dateOnlyProperty); // a } /// @@ -163,7 +170,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 16e3dfe57faa..3eaa0bc2895f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + return new DeprecatedObject(name); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index 810934b95efe..a7a3656d0aa4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,23 +32,29 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { - Breed = breed; + BreedOption = breed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + public Option BreedOption { get; private set; } // option d + /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public string Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -86,9 +93,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string breed = default; - string className = default; - string color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -105,14 +112,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -120,16 +127,19 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(breed, className, color); + return new Dog(className.Value!, breed, color); // a } /// @@ -156,9 +166,22 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); // 1 + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); // 1 + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index 68f7676ff91f..c8db08ac71de 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,40 +37,64 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { - MainShape = mainShape; - Shapes = shapes; - NullableShape = nullableShape; - ShapeOrNull = shapeOrNull; + MainShapeOption = mainShape; + ShapesOption = shapes; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + public Option MainShapeOption { get; private set; } // option d + /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + public Option> ShapesOption { get; private set; } // option d /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + public Option NullableShapeOption { get; private set; } // option d /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get; set; } + public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + public Option ShapeOrNullOption { get; private set; } // option d /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get; set; } + public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -138,10 +163,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape mainShape = default; - List shapes = default; - NullableShape nullableShape = default; - ShapeOrNull shapeOrNull = default; + Option mainShape = default; + Option> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -160,19 +185,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -180,13 +205,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a } /// @@ -213,14 +238,34 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) // 14 + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.ShapesOption.IsSet) // 14 + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 58cf3e310f81..45e29880f62f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { - ArrayEnum = arrayEnum; - JustSymbol = justSymbol; + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; OnCreated(); } @@ -100,7 +101,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -165,9 +165,8 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// /// /// - public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -177,17 +176,29 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + public Option JustSymbolOption { get; private set; } // option a + /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + public Option> ArrayEnumOption { get; private set; } // option d /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -243,8 +254,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -263,13 +274,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -277,13 +287,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + return new EnumArrays(arrayEnum, justSymbol); // a } /// @@ -310,10 +320,13 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnumOption.IsSet) // 14 + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs index 94c2361c8810..b1aff0adf0d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index f3310c22a12b..c9b8ad0f232f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,32 +32,188 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { - EnumInteger = enumInteger; - EnumIntegerOnly = enumIntegerOnly; - EnumNumber = enumNumber; - EnumString = enumString; EnumStringRequired = enumStringRequired; - OuterEnumDefaultValue = outerEnumDefaultValue; - OuterEnumInteger = outerEnumInteger; - OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; - OuterEnum = outerEnum; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OuterEnumOption = outerEnum; OnCreated(); } partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + /// /// Defines EnumInteger /// @@ -116,11 +273,17 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) return (int) value; } + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + public Option EnumIntegerOption { get; private set; } // option a + /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a /// /// Defines EnumIntegerOnly @@ -181,11 +344,17 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) return (int) value; } + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + public Option EnumIntegerOnlyOption { get; private set; } // option a + /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a /// /// Defines EnumNumber @@ -242,9 +411,8 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// /// /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) { - if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -254,11 +422,17 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + public Option EnumNumberOption { get; private set; } // option a + /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a /// /// Defines EnumString @@ -381,9 +555,8 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// /// /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) { - if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -412,191 +585,64 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) } /// - /// Gets or Sets EnumString + /// Used to track the state of EnumString /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + [JsonIgnore] + public Option EnumStringOption { get; private set; } // option a /// - /// Defines EnumStringRequired + /// Gets or Sets EnumString /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a /// - /// Returns a + /// Used to track the state of OuterEnumDefaultValue /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumDefaultValueOption { get; private set; } // option a /// - /// Returns a + /// Gets or Sets OuterEnumDefaultValue /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a /// - /// Converts the to the json value + /// Used to track the state of OuterEnumInteger /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumIntegerOption { get; private set; } // option a /// - /// Gets or Sets EnumStringRequired + /// Gets or Sets OuterEnumInteger /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a /// - /// Gets or Sets OuterEnumDefaultValue + /// Used to track the state of OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a /// - /// Gets or Sets OuterEnumInteger + /// Gets or Sets OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a /// - /// Gets or Sets OuterEnumIntegerDefaultValue + /// Used to track the state of OuterEnum /// - [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumOption { get; private set; } // option a /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -612,11 +658,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -659,15 +705,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -684,53 +730,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -738,31 +778,34 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a } /// @@ -789,44 +832,50 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - else - writer.WriteNull("outerEnumDefaultValue"); + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else + writer.WriteNull("enum_string"); + + if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) // 10 { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnumOption.IsSet) // 10 + if (enumTest.OuterEnumOption!.Value != null) // 10 a + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 626748ff2097..e37ce92d92a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index 905e5452f7c0..9cf97af03ad1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { - SourceURI = sourceURI; + SourceURIOption = sourceURI; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + public Option SourceURIOption { get; private set; } // option d + /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -101,7 +108,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()); break; default: break; @@ -127,10 +134,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + return new File(sourceURI); // a } /// @@ -157,7 +164,11 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 722ba3b949f0..d4c7047588e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option> files = default) { - File = file; - Files = files; + FileOption = file; + FilesOption = files; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of File + /// + [JsonIgnore] + public Option FileOption { get; private set; } // option d + /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public File File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + public Option> FilesOption { get; private set; } // option d /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public List Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File file = default; - List files = default; + Option file = default; + Option> files = default; while (utf8JsonReader.Read()) { @@ -129,11 +142,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -141,13 +154,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + return new FileSchemaTestClass(file, files); // a } /// @@ -174,10 +187,18 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) // 14 + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.FilesOption.IsSet) // 14 + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index 9cfe3b508fe8..365155901cf8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { - Bar = bar; + BarOption = bar; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; private set; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public string Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + return new Foo(bar); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c8291e8eae5b..709e634e9165 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { - VarString = varString; + VarStringOption = varString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d + /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + return new FooGetDefaultResponse(varString); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 30a9b189932a..2eeffd23f488 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,9 +32,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -41,8 +44,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -51,151 +52,241 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; - DateTime = dateTime; - VarDecimal = varDecimal; - VarDouble = varDouble; - VarFloat = varFloat; - Int32 = int32; - Int64 = int64; - Integer = integer; Number = number; Password = password; - PatternWithBackslash = patternWithBackslash; - PatternWithDigits = patternWithDigits; - PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; - VarString = varString; - UnsignedInteger = unsignedInteger; - UnsignedLong = unsignedLong; - Uuid = uuid; + BinaryOption = binary; + DateTimeOption = dateTime; + VarDecimalOption = varDecimal; + VarDoubleOption = varDouble; + VarFloatOption = varFloat; + Int32Option = int32; + Int64Option = int64; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + VarStringOption = varString; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } + public byte[] VarByte { get; set; } // d /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } + public DateTime Date { get; set; } // d + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } // d + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } // d + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + public Option BinaryOption { get; private set; } // option d + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of VarDecimal + /// + [JsonIgnore] + public Option VarDecimalOption { get; private set; } // option d /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + + /// + /// Used to track the state of VarDouble + /// + [JsonIgnore] + public Option VarDoubleOption { get; private set; } // option d /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + + /// + /// Used to track the state of VarFloat + /// + [JsonIgnore] + public Option VarFloatOption { get; private set; } // option d /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + public Option Int32Option { get; private set; } // option d /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + public Option Int64Option { get; private set; } // option d /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d /// - /// Gets or Sets Integer + /// Used to track the state of Integer /// - [JsonPropertyName("integer")] - public int Integer { get; set; } + [JsonIgnore] + public Option IntegerOption { get; private set; } // option d /// - /// Gets or Sets Number + /// Gets or Sets Integer /// - [JsonPropertyName("number")] - public decimal Number { get; set; } + [JsonPropertyName("integer")] + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d /// - /// Gets or Sets Password + /// Used to track the state of PatternWithBackslash /// - [JsonPropertyName("password")] - public string Password { get; set; } + [JsonIgnore] + public Option PatternWithBackslashOption { get; private set; } // option d /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + public Option PatternWithDigitsOption { get; private set; } // option d /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + public Option UnsignedIntegerOption { get; private set; } // option d /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + public Option UnsignedLongOption { get; private set; } // option d /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -211,9 +302,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -221,8 +314,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -242,122 +333,126 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslashOption.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigitsOption.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarStringOption.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + + if (this.VarStringOption.Value != null &&!regexVarString.Match(this.VarStringOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -398,25 +493,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream binary = default; - byte[] varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string password = default; - string patternWithBackslash = default; - string patternWithDigits = default; - string patternWithDigitsAndDelimiter = default; - string varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -433,76 +528,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -510,64 +605,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - if (varByte == null) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - if (date == null) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a } /// @@ -594,28 +701,79 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarStringOption.IsSet && formatTest.VarString == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + + writer.WriteNumber("number", formatTest.Number); // 3 + + writer.WriteString("password", formatTest.Password); // 1 + + if (formatTest.BinaryOption.IsSet) // 14 + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (formatTest.VarDecimalOption.IsSet) // 14 + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDoubleOption.IsSet) + writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + + if (formatTest.VarFloatOption.IsSet) + writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + + if (formatTest.VarStringOption.IsSet) + writer.WriteString("string", formatTest.VarString); // 1 + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index 2e05ffb958a4..75d815fe69da 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,10 +34,10 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; - Color = color; + ColorOption = color; OnCreated(); } @@ -45,10 +46,10 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; - Color = color; + ColorOption = color; OnCreated(); } @@ -64,11 +65,17 @@ public Fruit(Banana banana, string color) /// public Banana Banana { get; set; } + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d + /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -116,7 +123,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -156,7 +163,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -164,14 +171,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, color); // b if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, color); // b throw new JsonException(); } @@ -200,7 +207,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs index aa26d3600c05..7fd5e012fc5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -149,10 +150,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); + return new FruitReq(appleReq); // b if (bananaReq != null) - return new FruitReq(bananaReq); + return new FruitReq(bananaReq); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index 3c2d1ecefc94..d97438ec1919 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,31 +35,49 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple apple, Banana banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { - Apple = apple; - Banana = banana; - Color = color; + AppleOption = apple; + BananaOption = banana; + ColorOption = color; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + public Option AppleOption { get; private set; } // option b + /// /// Gets or Sets Apple /// - public Apple Apple { get; set; } + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + public Option BananaOption { get; private set; } // option b /// /// Gets or Sets Banana /// - public Banana Banana { get; set; } + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -106,7 +125,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -146,7 +165,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,10 +173,17 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); // a } /// @@ -171,16 +197,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.AppleOption.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.BananaOption.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -196,7 +222,11 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7ae4662ed8d4..5ff4fe800bfb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } + public string PetType { get; set; } // d /// /// Gets or Sets additional properties @@ -110,7 +111,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -128,7 +129,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -136,10 +137,13 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); - return new GrandparentAnimal(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(petType.Value!); // a } /// @@ -166,7 +170,10 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", grandparentAnimal.PetType); + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + + writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 31360d73f754..ba871e18b903 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { - Bar = bar; - Foo = foo; + BarOption = bar; + FooOption = foo; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + public Option FooOption { get; } // option d /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public string Foo { get { return this. FooOption; } } // d /// /// Gets or Sets additional properties @@ -105,8 +118,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); - hashCode = (hashCode * 59) + Foo.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -146,8 +163,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -165,10 +182,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()); break; default: break; @@ -176,13 +193,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + return new HasOnlyReadOnly(bar, foo); // a } /// @@ -209,8 +226,17 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 8355d97fa097..4c8d158466c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { - NullableMessage = nullableMessage; + NullableMessageOption = nullableMessage; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + public Option NullableMessageOption { get; private set; } // option d + /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get; set; } + public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,7 +133,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); + return new HealthCheckResult(nullableMessage); // a } /// @@ -153,7 +160,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 0355613042f2..da3be2221d8a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -121,10 +122,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -132,13 +133,19 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -165,8 +172,15 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index 42b0c9cb2cf1..45ab2d2f47e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { - Var123List = var123List; + Var123ListOption = var123List; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + public Option Var123ListOption { get; private set; } // option d + /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + return new List(var123List); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0ad8832af885..0832d03a155a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { - EscapedLiteralString = escapedLiteralString; - UnescapedLiteralString = unescapedLiteralString; + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + public Option EscapedLiteralStringOption { get; private set; } // option d + /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + public Option UnescapedLiteralStringOption { get; private set; } // option d /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string escapedLiteralString = default; - string unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -128,10 +141,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +152,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a } /// @@ -172,8 +185,17 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 92011ad0e1d9..865228b52539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -85,7 +86,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -150,7 +151,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; Pig pig = null; Whale whale = null; @@ -207,7 +208,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,20 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, className.Value!); // c if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, className.Value!); // c if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, className.Value!); // c throw new JsonException(); } @@ -269,7 +273,10 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", mammal.ClassName); + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + + writer.WriteString("className", mammal.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index a4fdf221e931..b3f67421f044 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,12 +37,12 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { - DirectMap = directMap; - IndirectMap = indirectMap; - MapMapOfString = mapMapOfString; - MapOfEnumString = mapOfEnumString; + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; OnCreated(); } @@ -104,7 +105,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; @@ -114,29 +114,53 @@ public static string InnerEnumToJsonValue(InnerEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + public Option> DirectMapOption { get; private set; } // option d + /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + public Option> IndirectMapOption { get; private set; } // option d /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + public Option>> MapMapOfStringOption { get; private set; } // option d /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + public Option> MapOfEnumStringOption { get; private set; } // option d /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -194,10 +218,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary directMap = default; - Dictionary indirectMap = default; - Dictionary> mapMapOfString = default; - Dictionary mapOfEnumString = default; + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -216,19 +240,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -236,19 +260,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a } /// @@ -275,14 +299,30 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) // 14 + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMapOption.IsSet) // 14 + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfStringOption.IsSet) // 14 + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumStringOption.IsSet) // 14 + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 0ed70f02c2db..fb24dc40b09a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,40 +37,64 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { - DateTime = dateTime; - Map = map; - Uuid = uuid; - UuidWithPattern = uuidWithPattern; + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d + /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + public Option> MapOption { get; private set; } // option d /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + public Option UuidWithPatternOption { get; private set; } // option d /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -103,7 +128,8 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -138,10 +164,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -160,19 +186,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -180,19 +206,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a } /// @@ -219,11 +245,20 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 7969b9ae04ed..e4186b32440e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { - VarClass = varClass; - Name = name; + VarClassOption = varClass; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -140,13 +153,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + return new Model200Response(varClass, name); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClassOption.IsSet && model200Response.VarClass == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + + if (model200Response.VarClassOption.IsSet) + writer.WriteString("class", model200Response.VarClass); // 1 + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index 810a6a01b8e9..db0925940805 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { - VarClient = varClient; + VarClientOption = varClient; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + public Option VarClientOption { get; private set; } // option d + /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + return new ModelClient(varClient); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index edcb6b3403c7..f1727bc48f4f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,12 +37,12 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; - Property = property; - SnakeCase = snakeCase; - Var123Number = var123Number; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; OnCreated(); } @@ -51,25 +52,43 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } + public int VarName { get; set; } // d + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + public Option PropertyOption { get; private set; } // option d /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + public Option SnakeCaseOption { get; } // option d /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + public Option Var123NumberOption { get; } // option d /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public int? Var123Number { get { return this. Var123NumberOption; } } // d /// /// Gets or Sets additional properties @@ -123,8 +142,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); - hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -164,10 +187,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -186,18 +209,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -205,19 +228,22 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a } /// @@ -244,10 +270,19 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); // 3 + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); // 1 + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 83ab7f40b1e8..2a9cd20a4a70 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } + public List> AObjVariableobject { get; set; } // d /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } + public int PkiNotificationtestID { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -141,13 +142,19 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); - if (pkiNotificationtestID == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a } /// @@ -174,9 +181,12 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 5d9de18c4a36..164ffab196f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,96 +45,168 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullable = arrayItemsNullable; - ObjectItemsNullable = objectItemsNullable; - ArrayAndItemsNullableProp = arrayAndItemsNullableProp; - ArrayNullableProp = arrayNullableProp; - BooleanProp = booleanProp; - DateProp = dateProp; - DatetimeProp = datetimeProp; - IntegerProp = integerProp; - NumberProp = numberProp; - ObjectAndItemsNullableProp = objectAndItemsNullableProp; - ObjectNullableProp = objectNullableProp; - StringProp = stringProp; + ArrayItemsNullableOption = arrayItemsNullable; + ObjectItemsNullableOption = objectItemsNullable; + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + public Option> ArrayItemsNullableOption { get; private set; } // option d + /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + public Option> ObjectItemsNullableOption { get; private set; } // option d /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + public Option> ArrayAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get; set; } + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + public Option> ArrayNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get; set; } + public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + public Option BooleanPropOption { get; private set; } // option d /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + public Option DatePropOption { get; private set; } // option d /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + public Option DatetimePropOption { get; private set; } // option d /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + public Option IntegerPropOption { get; private set; } // option d /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + public Option NumberPropOption { get; private set; } // option d /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + public Option> ObjectAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get; set; } + public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + public Option> ObjectNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get; set; } + public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + public Option StringPropOption { get; private set; } // option d /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get; set; } + public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -220,18 +293,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayItemsNullable = default; - Dictionary objectItemsNullable = default; - List arrayAndItemsNullableProp = default; - List arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary objectAndItemsNullableProp = default; - Dictionary objectNullableProp = default; - string stringProp = default; + Option> arrayItemsNullable = default; + Option> objectItemsNullable = default; + Option> arrayAndItemsNullableProp = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -250,50 +323,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -301,13 +374,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a } /// @@ -334,45 +407,85 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); // 1 + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 684109acd50f..ce93066cda32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { - Uuid = uuid; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d + /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -101,7 +108,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -128,7 +135,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); + return new NullableGuidClass(uuid); // a } /// @@ -155,11 +162,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index a44c950b81bb..b78d55de1444 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", nullableShape.ShapeType); + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + + writer.WriteString("shapeType", nullableShape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 3f3cbf4c5059..1076161e96ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { - JustNumber = justNumber; + JustNumberOption = justNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + public Option JustNumberOption { get; private set; } // option d + /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +134,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + return new NumberOnly(justNumber); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 57a1614f29f4..8d1521c2a30d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,43 +37,67 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { - Bars = bars; - DeprecatedRef = deprecatedRef; - Id = id; - Uuid = uuid; + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + public Option> BarsOption { get; private set; } // option d + /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public List Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + public Option DeprecatedRefOption { get; private set; } // option d /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -130,10 +155,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List bars = default; - DeprecatedObject deprecatedRef = default; - decimal? id = default; - string uuid = default; + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -152,18 +177,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()); break; default: break; @@ -171,19 +196,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a } /// @@ -210,12 +235,26 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs index 91dd67631614..99d1c17f0843 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -121,10 +122,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index 3258ff154478..22475999e083 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,14 +39,14 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { - Id = id; - PetId = petId; - Quantity = quantity; - ShipDate = shipDate; - Status = status; - Complete = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + CompleteOption = complete; OnCreated(); } @@ -118,9 +119,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Placed) return "placed"; @@ -133,43 +133,79 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + public Option PetIdOption { get; private set; } // option d /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + public Option QuantityOption { get; private set; } // option d /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + public Option ShipDateOption { get; private set; } // option d /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + public Option CompleteOption { get; private set; } // option d /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -234,12 +270,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -258,29 +294,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -288,25 +323,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + return new Order(id, petId, quantity, shipDate, status, complete); // a } /// @@ -333,18 +368,26 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index c37883db124b..e4aa6c30a7c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { - MyBoolean = myBoolean; - MyNumber = myNumber; - MyString = myString; + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + public Option MyBooleanOption { get; private set; } // option d + /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + public Option MyNumberOption { get; private set; } // option d /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + public Option MyStringOption { get; private set; } // option d /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -139,14 +158,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,16 +173,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + return new OuterComposite(myBoolean, myNumber, myString); // a } /// @@ -190,9 +209,17 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs index a4ec335bb386..47bb6793c6ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7c67db5ddca3..136fb4c54c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 84ea65297ab0..2ed4f18a657e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 983d194a1998..c6a470cc64d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 51d8bee407e0..a2e789f2edef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index eb0129c6ce0f..fb7e69bbe4c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -76,7 +77,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -94,7 +95,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -102,10 +103,13 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); - return new ParentPet(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(petType.Value!); // a } /// @@ -132,7 +136,10 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", parentPet.PetType); + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + + writer.WriteString("pet_type", parentPet.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 225a9c5328c0..5ba524071188 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,21 +32,21 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; - Status = status; - Tags = tags; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; OnCreated(); } @@ -118,9 +119,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Available) return "available"; @@ -133,43 +133,67 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + + /// + /// Gets or Sets Name + /// + /// doggie + [JsonPropertyName("name")] + public string Name { get; set; } // d + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } // d + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + public Option CategoryOption { get; private set; } // option d /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get; set; } + public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d /// - /// Gets or Sets Id + /// Used to track the state of Id /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// - /// Gets or Sets Name + /// Gets or Sets Id /// - /// doggie - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d /// - /// Gets or Sets PhotoUrls + /// Used to track the state of Tags /// - [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } + [JsonIgnore] + public Option> TagsOption { get; private set; } // option d /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public List Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -185,10 +209,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -229,12 +253,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category category = default; - long? id = default; - string name = default; - List photoUrls = default; - Pet.StatusEnum? status = default; - List tags = default; + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; while (utf8JsonReader.Read()) { @@ -251,30 +275,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -282,25 +305,31 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); - if (photoUrls == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a } /// @@ -327,21 +356,37 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); // 1 + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 + if (pet.CategoryOption.IsSet) // 14 + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.TagsOption.IsSet) // 14 + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index 8185d643e794..e523ab4cf7d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -184,7 +185,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, className.Value!); // c if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, className.Value!); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", pig.ClassName); + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + + writer.WriteString("className", pig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 3a89a8716e07..78791de532b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -194,16 +195,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); + return new PolymorphicProperty(varBool); // b if (varString != null) - return new PolymorphicProperty(varString); + return new PolymorphicProperty(varString); // b if (varObject != null) - return new PolymorphicProperty(varObject); + return new PolymorphicProperty(varObject); // b if (list != null) - return new PolymorphicProperty(list); + return new PolymorphicProperty(list); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 65f7b8b4536f..361ee03b2c66 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -184,7 +185,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index c329eed3266b..e5325f631f49 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value!); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 2c8b4fff43d6..450798bad130 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { - Bar = bar; - Baz = baz; + BarOption = bar; + BazOption = baz; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + public Option BazOption { get; private set; } // option d /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public string Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -105,7 +118,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -145,8 +160,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -164,10 +179,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()); break; default: break; @@ -175,13 +190,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + return new ReadOnlyFirst(bar, baz); // a } /// @@ -208,8 +223,17 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); // 1 + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..aa4bc1dd4971 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2362 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } // d + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } // d + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + public Option NotrequiredNullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + + if (requiredClass.RequiredNullableArrayOfString != null) // 12 + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + else + writer.WriteNull("required_nullable_uuid"); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index 86e7223ee957..8cc08b09316a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { - VarReturn = varReturn; + VarReturnOption = varReturn; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + public Option VarReturnOption { get; private set; } // option d + /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -127,10 +134,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + return new Return(varReturn); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 86effcebe7ae..f953c8b0fadb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { - Role = role; - RoleUuid = roleUuid; + RoleOption = role; + RoleUuidOption = roleUuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Role + /// + [JsonIgnore] + public Option RoleOption { get; private set; } // option d + /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + public Option RoleUuidOption { get; private set; } // option d /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -129,11 +142,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -141,13 +154,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + return new RolesReportsHash(role, roleUuid); // a } /// @@ -174,9 +187,14 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) // 14 + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index c7002b77b2e1..abaec09fac9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + return new RolesReportsHashRole(name); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 4151ead57dfb..6e9e826d22db 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index dae0ef02f966..49209ef9dd5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shape.ShapeType); + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + + writer.WriteString("shapeType", shape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index de32fa535aec..107fd5c5b50d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); - return new ShapeInterface(shapeType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value!); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeInterface.ShapeType); + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 955461e12024..6d2a3cf825fc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeType.Value!); // c if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeType.Value!); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeOrNull.ShapeType); + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + + writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 7f0b8a306f80..d4b69fe3cfd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 8328ad3ee121..9dcde944d87d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { - VarSpecialModelName = varSpecialModelName; - SpecialPropertyName = specialPropertyName; + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + public Option VarSpecialModelNameOption { get; private set; } // option d + /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + public Option SpecialPropertyNameOption { get; private set; } // option d /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +153,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + return new SpecialModelName(varSpecialModelName, specialPropertyName); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index 6524d75edcf5..9b5a9c908653 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { - Id = id; - Name = name; + IdOption = id; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d + /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -129,10 +142,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -140,13 +153,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + return new Tag(id, name); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b2e110e79f67..02c45f70d155 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { - Value = value; + ValueOption = value; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Value + /// + [JsonIgnore] + public Option ValueOption { get; private set; } // option d + /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public string Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + return new TestCollectionEndingWithWordList(value); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 8753edfd9f35..223580adaab0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { - TestCollectionEndingWithWordList = testCollectionEndingWithWordList; + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + public Option> TestCollectionEndingWithWordListOption { get; private set; } // option d + /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List testCollectionEndingWithWordList = default; + Option> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 139e92b4c6a8..eb5429eca152 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { - SomeProperty = someProperty; + SomePropertyOption = someProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + public Option SomePropertyOption { get; private set; } // option d + /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -111,7 +118,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +136,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()); break; default: break; @@ -137,10 +144,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a } /// @@ -167,7 +174,11 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index 814316961f91..7bf6112e9061 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -85,7 +86,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -150,7 +151,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -207,7 +208,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,20 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleType.Value!); // c if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleType.Value!); // c if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleType.Value!); // c throw new JsonException(); } @@ -269,7 +273,10 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangle.TriangleType); + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + + writer.WriteString("triangleType", triangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 6bd1e4303a70..ff8c445e09f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); - return new TriangleInterface(triangleType); + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value!); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangleInterface.TriangleType); + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index ea527b94ec08..29c96c8dda9a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,101 +45,173 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { - Email = email; - FirstName = firstName; - Id = id; - LastName = lastName; - ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; - Password = password; - Phone = phone; - UserStatus = userStatus; - Username = username; - AnyTypeProp = anyTypeProp; - AnyTypePropNullable = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Email + /// + [JsonIgnore] + public Option EmailOption { get; private set; } // option d + /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public string Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + public Option FirstNameOption { get; private set; } // option d /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + public Option LastNameOption { get; private set; } // option d /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + public Option PasswordOption { get; private set; } // option d /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + public Option PhoneOption { get; private set; } // option d /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + public Option UserStatusOption { get; private set; } // option d /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + public Option UsernameOption { get; private set; } // option d /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + public Option AnyTypePropOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get; set; } + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + public Option AnyTypePropNullableOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get; set; } + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get; set; } + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -204,18 +277,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string email = default; - string firstName = default; - long? id = default; - string lastName = default; - Object objectWithNoDeclaredProps = default; - string password = default; - string phone = default; - int? userStatus = default; - string username = default; - Object anyTypeProp = default; - Object anyTypePropNullable = default; - Object objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -233,46 +306,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -280,34 +353,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a } /// @@ -334,22 +407,78 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); // 1 + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); // 1 + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); // 1 + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); // 1 + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); // 1 + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); // 1 + + if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index e633a5c92cf5..a126a02ca047 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,11 +36,11 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; - HasBaleen = hasBaleen; - HasTeeth = hasTeeth; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; OnCreated(); } @@ -49,19 +50,31 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + public Option HasBaleenOption { get; private set; } // option d /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + public Option HasTeethOption { get; private set; } // option d /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +131,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -138,15 +151,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -154,16 +167,19 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + return new Whale(className.Value!, hasBaleen, hasTeeth); // a } /// @@ -190,9 +206,16 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); // 1 + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 52135d8a3c51..601d83a6a269 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; - Type = type; + TypeOption = type; OnCreated(); } @@ -109,9 +110,8 @@ public static TypeEnum TypeEnumFromString(string value) /// /// /// - public static string TypeEnumToJsonValue(TypeEnum value) + public static string TypeEnumToJsonValue(TypeEnum? value) { - if (value == TypeEnum.Plains) return "plains"; @@ -124,17 +124,23 @@ public static string TypeEnumToJsonValue(TypeEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option a + /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -201,8 +207,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -220,13 +226,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -234,13 +239,16 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + return new Zebra(className.Value!, type); // a } /// @@ -267,9 +275,12 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); // 1 - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 20e184f02b2b..34a044fb8b13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 7e5f3cdafcca..8230f6a7f0b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,9 +34,9 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { - ZeroBasedEnum = zeroBasedEnum; + ZeroBasedEnumOption = zeroBasedEnum; OnCreated(); } @@ -96,9 +97,8 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// /// /// - public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -108,11 +108,17 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + public Option ZeroBasedEnumOption { get; private set; } // option a + /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a /// /// Gets or Sets additional properties @@ -167,7 +173,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -186,9 +192,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -196,10 +201,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + return new ZeroBasedEnumClass(zeroBasedEnum); // a } /// @@ -226,8 +231,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs index 663aecff33e7..b3419229d654 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index 93bfff98acc2..5c246bae8ecb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,19 +39,25 @@ public partial class Adult : Person, IValidatableObject /// lastName /// type [JsonConstructor] - public Adult(List children, string firstName, string lastName, string type) : base(firstName, lastName, type) + public Adult(Option?> children = default, Option firstName = default, Option lastName = default, Option type = default) : base(firstName, lastName, type) { - Children = children; + ChildrenOption = children; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Children + /// + [JsonIgnore] + public Option?> ChildrenOption { get; private set; } // option d + /// /// Gets or Sets Children /// [JsonPropertyName("children")] - public List Children { get; set; } + public List? Children { get { return this. ChildrenOption; } set { this.ChildrenOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -89,10 +96,10 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List? children = default; - string? firstName = default; - string? lastName = default; - string? type = default; + Option?> children = default; + Option firstName = default; + Option lastName = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -111,16 +118,16 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "children": if (utf8JsonReader.TokenType != JsonTokenType.Null) - children = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + children = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,19 +135,19 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (children == null) - throw new ArgumentNullException(nameof(children), "Property is required for class Adult."); + if (children.IsSet && children.Value == null) + throw new ArgumentNullException(nameof(children), "Property is not nullable for class Adult."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Adult."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Adult."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Adult."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Adult."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Adult."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult."); - return new Adult(children, firstName, lastName, type); + return new Adult(children, firstName, lastName, type); // a } /// @@ -167,11 +174,29 @@ public override void Write(Utf8JsonWriter writer, Adult adult, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("children"); - JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); - writer.WriteString("firstName", adult.FirstName); - writer.WriteString("lastName", adult.LastName); - writer.WriteString("$_type", adult.Type); + if (adult.ChildrenOption.IsSet && adult.Children == null) + throw new ArgumentNullException(nameof(adult.Children), "Property is required for class Adult."); + + if (adult.FirstNameOption.IsSet && adult.FirstName == null) + throw new ArgumentNullException(nameof(adult.FirstName), "Property is required for class Adult."); + + if (adult.LastNameOption.IsSet && adult.LastName == null) + throw new ArgumentNullException(nameof(adult.LastName), "Property is required for class Adult."); + + if (adult.TypeOption.IsSet && adult.Type == null) + throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult."); + + if (adult.ChildrenOption.IsSet) // 14 + writer.WritePropertyName("children"); + JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + if (adult.FirstNameOption.IsSet) + writer.WriteString("firstName", adult.FirstName); // 1 + + if (adult.LastNameOption.IsSet) + writer.WriteString("lastName", adult.LastName); // 1 + + if (adult.TypeOption.IsSet) + writer.WriteString("$_type", adult.Type); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index 0814fec25b7a..a8b4c3f6fc24 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -39,26 +40,38 @@ public partial class Child : Person, IValidatableObject /// type /// boosterSeat [JsonConstructor] - public Child(int age, string firstName, string lastName, string type, bool boosterSeat) : base(firstName, lastName, type) + public Child(Option age = default, Option firstName = default, Option lastName = default, Option type = default, Option boosterSeat = default) : base(firstName, lastName, type) { - Age = age; - BoosterSeat = boosterSeat; + AgeOption = age; + BoosterSeatOption = boosterSeat; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Age + /// + [JsonIgnore] + public Option AgeOption { get; private set; } // option d + /// /// Gets or Sets Age /// [JsonPropertyName("age")] - public int Age { get; set; } + public int? Age { get { return this. AgeOption; } set { this.AgeOption = new(value); } } // d + + /// + /// Used to track the state of BoosterSeat + /// + [JsonIgnore] + public Option BoosterSeatOption { get; private set; } // option d /// /// Gets or Sets BoosterSeat /// [JsonPropertyName("boosterSeat")] - public bool BoosterSeat { get; set; } + public bool? BoosterSeat { get { return this. BoosterSeatOption; } set { this.BoosterSeatOption = new(value); } } // d /// /// Returns the string presentation of the object @@ -98,11 +111,11 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? age = default; - string? firstName = default; - string? lastName = default; - string? type = default; - bool? boosterSeat = default; + Option age = default; + Option firstName = default; + Option lastName = default; + Option type = default; + Option boosterSeat = default; while (utf8JsonReader.Read()) { @@ -121,20 +134,20 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "age": if (utf8JsonReader.TokenType != JsonTokenType.Null) - age = utf8JsonReader.GetInt32(); + age = new Option(utf8JsonReader.GetInt32()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; case "boosterSeat": if (utf8JsonReader.TokenType != JsonTokenType.Null) - boosterSeat = utf8JsonReader.GetBoolean(); + boosterSeat = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -142,22 +155,22 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (age == null) - throw new ArgumentNullException(nameof(age), "Property is required for class Child."); + if (age.IsSet && age.Value == null) + throw new ArgumentNullException(nameof(age), "Property is not nullable for class Child."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Child."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Child."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Child."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Child."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Child."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Child."); - if (boosterSeat == null) - throw new ArgumentNullException(nameof(boosterSeat), "Property is required for class Child."); + if (boosterSeat.IsSet && boosterSeat.Value == null) + throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child."); - return new Child(age.Value, firstName, lastName, type, boosterSeat.Value); + return new Child(age, firstName, lastName, type, boosterSeat); // a } /// @@ -184,11 +197,29 @@ public override void Write(Utf8JsonWriter writer, Child child, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("age", child.Age); - writer.WriteString("firstName", child.FirstName); - writer.WriteString("lastName", child.LastName); - writer.WriteString("$_type", child.Type); - writer.WriteBoolean("boosterSeat", child.BoosterSeat); + if (child.FirstNameOption.IsSet && child.FirstName == null) + throw new ArgumentNullException(nameof(child.FirstName), "Property is required for class Child."); + + if (child.LastNameOption.IsSet && child.LastName == null) + throw new ArgumentNullException(nameof(child.LastName), "Property is required for class Child."); + + if (child.TypeOption.IsSet && child.Type == null) + throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child."); + + if (child.AgeOption.IsSet) + writer.WriteNumber("age", child.AgeOption.Value!.Value); // 3 + + if (child.FirstNameOption.IsSet) + writer.WriteString("firstName", child.FirstName); // 1 + + if (child.LastNameOption.IsSet) + writer.WriteString("lastName", child.LastName); // 1 + + if (child.TypeOption.IsSet) + writer.WriteString("$_type", child.Type); // 1 + + if (child.BoosterSeatOption.IsSet) + writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index 150e974367e1..41ce78a860b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -37,33 +38,51 @@ public partial class Person : IValidatableObject /// lastName /// type [JsonConstructor] - public Person(string firstName, string lastName, string type) + public Person(Option firstName = default, Option lastName = default, Option type = default) { - FirstName = firstName; - LastName = lastName; - Type = type; + FirstNameOption = firstName; + LastNameOption = lastName; + TypeOption = type; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + public Option FirstNameOption { get; private set; } // option d + /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + public Option LastNameOption { get; private set; } // option d /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option d /// /// Gets or Sets Type /// [JsonPropertyName("$_type")] - public string Type { get; set; } + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -130,9 +149,9 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? firstName = default; - string? lastName = default; - string? type = default; + Option firstName = default; + Option lastName = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -150,13 +169,13 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()!); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()!); break; case "$_type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -164,16 +183,16 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class Person."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class Person."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class Person."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class Person."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Person."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person."); - return new Person(firstName, lastName, type); + return new Person(firstName, lastName, type); // a } /// @@ -200,9 +219,23 @@ public override void Write(Utf8JsonWriter writer, Person person, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("firstName", person.FirstName); - writer.WriteString("lastName", person.LastName); - writer.WriteString("$_type", person.Type); + if (person.FirstNameOption.IsSet && person.FirstName == null) + throw new ArgumentNullException(nameof(person.FirstName), "Property is required for class Person."); + + if (person.LastNameOption.IsSet && person.LastName == null) + throw new ArgumentNullException(nameof(person.LastName), "Property is required for class Person."); + + if (person.TypeOption.IsSet && person.Type == null) + throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person."); + + if (person.FirstNameOption.IsSet) + writer.WriteString("firstName", person.FirstName); // 1 + + if (person.LastNameOption.IsSet) + writer.WriteString("lastName", person.LastName); // 1 + + if (person.TypeOption.IsSet) + writer.WriteString("$_type", person.Type); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs index 3c370b043a54..6f4db75a4454 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index 376581340835..a1badbbd472a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(string kind) + public Apple(Option kind = default) { - Kind = kind; + KindOption = kind; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Kind + /// + [JsonIgnore] + public Option KindOption { get; private set; } // option d + /// /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string Kind { get; set; } + public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? kind = default; + Option kind = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = utf8JsonReader.GetString(); + kind = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind == null) - throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); + if (kind.IsSet && kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); + return new Apple(kind); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("kind", apple.Kind); + if (apple.KindOption.IsSet && apple.Kind == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + + if (apple.KindOption.IsSet) + writer.WriteString("kind", apple.Kind); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs index 003d499475e9..bb3fcdc28fda 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(decimal count) + public Banana(Option count = default) { - Count = count; + CountOption = count; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Count + /// + [JsonIgnore] + public Option CountOption { get; private set; } // option d + /// /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal Count { get; set; } + public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? count = default; + Option count = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = utf8JsonReader.GetDecimal(); + count = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +136,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count == null) - throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); + if (count.IsSet && count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count.Value); + return new Banana(count); // a } /// @@ -159,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("count", banana.Count); + if (banana.CountOption.IsSet) + writer.WriteNumber("count", banana.CountOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index 7cd885961b7b..3095dd9ba870 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,31 +37,49 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple? apple, Banana? banana, string color) + public Fruit(Option apple, Option banana, Option color = default) { - Apple = apple; - Banana = banana; - Color = color; + AppleOption = apple; + BananaOption = banana; + ColorOption = color; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + public Option AppleOption { get; private set; } // option b + /// /// Gets or Sets Apple /// - public Apple? Apple { get; set; } + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + public Option BananaOption { get; private set; } // option b /// /// Gets or Sets Banana /// - public Banana? Banana { get; set; } + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -115,7 +134,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -155,7 +174,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -163,10 +182,17 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); - return new Fruit(apple, banana, color); + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new Fruit(appleParsedValue, bananaParsedValue, color); // a } /// @@ -180,16 +206,16 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt { writer.WriteStartObject(); - if (fruit.Apple != null) + if (fruit.AppleOption.IsSet && fruit.AppleOption.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, fruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, fruit.AppleOption.Value, jsonSerializerOptions); } - if (fruit.Banana != null) + if (fruit.BananaOption.IsSet && fruit.BananaOption.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, fruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(fruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, fruit.BananaOption.Value, jsonSerializerOptions); } WriteProperties(ref writer, fruit, jsonSerializerOptions); @@ -205,7 +231,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs index 3c370b043a54..6f4db75a4454 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Client/Option.cs @@ -37,5 +37,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index 376581340835..a1badbbd472a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Apple : IValidatableObject /// /// kind [JsonConstructor] - public Apple(string kind) + public Apple(Option kind = default) { - Kind = kind; + KindOption = kind; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Kind + /// + [JsonIgnore] + public Option KindOption { get; private set; } // option d + /// /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string Kind { get; set; } + public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? kind = default; + Option kind = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "kind": - kind = utf8JsonReader.GetString(); + kind = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -128,10 +135,10 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (kind == null) - throw new ArgumentNullException(nameof(kind), "Property is required for class Apple."); + if (kind.IsSet && kind.Value == null) + throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); + return new Apple(kind); // a } /// @@ -158,7 +165,11 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("kind", apple.Kind); + if (apple.KindOption.IsSet && apple.Kind == null) + throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); + + if (apple.KindOption.IsSet) + writer.WriteString("kind", apple.Kind); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs index 003d499475e9..bb3fcdc28fda 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Banana : IValidatableObject /// /// count [JsonConstructor] - public Banana(decimal count) + public Banana(Option count = default) { - Count = count; + CountOption = count; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Count + /// + [JsonIgnore] + public Option CountOption { get; private set; } // option d + /// /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal Count { get; set; } + public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -102,7 +109,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? count = default; + Option count = default; while (utf8JsonReader.Read()) { @@ -121,7 +128,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "count": if (utf8JsonReader.TokenType != JsonTokenType.Null) - count = utf8JsonReader.GetDecimal(); + count = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -129,10 +136,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (count == null) - throw new ArgumentNullException(nameof(count), "Property is required for class Banana."); + if (count.IsSet && count.Value == null) + throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count.Value); + return new Banana(count); // a } /// @@ -159,7 +166,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("count", banana.Count); + if (banana.CountOption.IsSet) + writer.WriteNumber("count", banana.CountOption.Value!.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index 4310e800fe99..4c3b1f4893a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -22,6 +22,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,10 +36,10 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; - Color = color; + ColorOption = color; OnCreated(); } @@ -47,10 +48,10 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; - Color = color; + ColorOption = color; OnCreated(); } @@ -66,11 +67,17 @@ public Fruit(Banana banana, string color) /// public Banana? Banana { get; set; } + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d + /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d /// /// Gets or Sets additional properties @@ -125,7 +132,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string? color = default; + Option color = default; Apple? apple = default; Banana? banana = default; @@ -165,7 +172,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()!); break; default: break; @@ -173,14 +180,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, color); // b if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, color); // b throw new JsonException(); } @@ -209,7 +216,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES index 1179de6767be..05049077c2ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/FILES @@ -79,6 +79,7 @@ docs/models/PolymorphicProperty.md docs/models/Quadrilateral.md docs/models/QuadrilateralInterface.md docs/models/ReadOnlyFirst.md +docs/models/RequiredClass.md docs/models/Return.md docs/models/RolesReportsHash.md docs/models/RolesReportsHashRole.md @@ -206,6 +207,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION index 40e36364ab27..717311e32e3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION @@ -1 +1 @@ -7.1.0-SNAPSHOT \ No newline at end of file +unset \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md index 6eb0a2e13eaa..c2cf3f8e919e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Id** | **long** | | [optional] **Name** | **string** | | [default to "default-name"] +**Id** | **long** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md index 53bbfe31e77c..470701a32abc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**EnumStringRequired** | **string** | | **EnumInteger** | **int** | | [optional] **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] -**EnumStringRequired** | **string** | | **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md index 28f1a8093581..ab628ed7bc0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/FormatTest.md @@ -4,9 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Binary** | **System.IO.Stream** | | [optional] **VarByte** | **byte[]** | | **Date** | **DateTime** | | +**Number** | **decimal** | | +**Password** | **string** | | +**Binary** | **System.IO.Stream** | | [optional] **DateTime** | **DateTime** | | [optional] **VarDecimal** | **decimal** | | [optional] **VarDouble** | **double** | | [optional] @@ -14,8 +16,6 @@ Name | Type | Description | Notes **Int32** | **int** | | [optional] **Int64** | **long** | | [optional] **Integer** | **int** | | [optional] -**Number** | **decimal** | | -**Password** | **string** | | **PatternWithBackslash** | **string** | None | [optional] **PatternWithDigits** | **string** | A string that is a 10 digit number. Can have leading zeros. | [optional] **PatternWithDigitsAndDelimiter** | **string** | A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md index b13bb576b450..4f019b613bd7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Pet.md @@ -4,10 +4,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Category** | [**Category**](Category.md) | | [optional] -**Id** | **long** | | [optional] **Name** | **string** | | **PhotoUrls** | **List<string>** | | +**Category** | [**Category**](Category.md) | | [optional] +**Id** | **long** | | [optional] **Status** | **string** | pet status in the store | [optional] **Tags** | [**List<Tag>**](Tag.md) | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md new file mode 100644 index 000000000000..5ff4cb1b73cc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNotNullableDateProp** | **DateTime** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNotnullableEnumInteger** | **int** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**RequiredNotnullableEnumString** | **string** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableStringProp** | **string** | | +**RequiredNotnullableUuid** | **Guid** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNullableBooleanProp** | **bool** | | +**RequiredNullableDateProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime** | | +**RequiredNullableEnumInteger** | **int** | | +**RequiredNullableEnumIntegerOnly** | **int** | | +**RequiredNullableEnumString** | **string** | | +**RequiredNullableIntegerProp** | **int** | | +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNullableStringProp** | **string** | | +**RequiredNullableUuid** | **Guid** | | +**NotRequiredNullableDateProp** | **DateTime** | | [optional] +**NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNullableBooleanProp** | **bool** | | [optional] +**NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNullableEnumInteger** | **int** | | [optional] +**NotrequiredNullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNullableUuid** | **Guid** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..6e8958b1b749 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,452 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 485ee4c9a081..7982f6cfc930 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -141,6 +141,8 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumArrays.JustSymbolEnumToJsonValue(enumArraysJustSymbolEnum); if (obj is EnumClass enumClass) return EnumClassValueConverter.ToJsonValue(enumClass); + if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) + return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is EnumTest.EnumIntegerEnum enumTestEnumIntegerEnum) return EnumTest.EnumIntegerEnumToJsonValue(enumTestEnumIntegerEnum).ToString(); if (obj is EnumTest.EnumIntegerOnlyEnum enumTestEnumIntegerOnlyEnum) @@ -149,8 +151,6 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return EnumTest.EnumNumberEnumToJsonValue(enumTestEnumNumberEnum).ToString(); if (obj is EnumTest.EnumStringEnum enumTestEnumStringEnum) return EnumTest.EnumStringEnumToJsonValue(enumTestEnumStringEnum); - if (obj is EnumTest.EnumStringRequiredEnum enumTestEnumStringRequiredEnum) - return EnumTest.EnumStringRequiredEnumToJsonValue(enumTestEnumStringRequiredEnum); if (obj is MapTest.InnerEnum mapTestInnerEnum) return MapTest.InnerEnumToJsonValue(mapTestInnerEnum); if (obj is Order.StatusEnum orderStatusEnum) @@ -167,6 +167,30 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return OuterEnumTestValueConverter.ToJsonValue(outerEnumTest); if (obj is Pet.StatusEnum petStatusEnum) return Pet.StatusEnumToJsonValue(petStatusEnum); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerEnum requiredClassRequiredNotnullableEnumIntegerEnum) + return RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum requiredClassRequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) + return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); + if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) + return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) + return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) + return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNullableEnumStringEnum requiredClassNotrequiredNullableEnumStringEnum) + return RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClassNotrequiredNullableEnumStringEnum); if (obj is Zebra.TypeEnum zebraTypeEnum) return Zebra.TypeEnumToJsonValue(zebraTypeEnum); if (obj is ZeroBasedEnum zeroBasedEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs index 964d9c24a144..903a95cb48ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/HostConfiguration.cs @@ -114,6 +114,7 @@ public HostConfiguration(IServiceCollection services) _jsonOptions.Converters.Add(new QuadrilateralJsonConverter()); _jsonOptions.Converters.Add(new QuadrilateralInterfaceJsonConverter()); _jsonOptions.Converters.Add(new ReadOnlyFirstJsonConverter()); + _jsonOptions.Converters.Add(new RequiredClassJsonConverter()); _jsonOptions.Converters.Add(new ReturnJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashJsonConverter()); _jsonOptions.Converters.Add(new RolesReportsHashRoleJsonConverter()); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs index 70f41078bb68..8cf79a713b74 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/Option.cs @@ -35,5 +35,17 @@ public Option(TType value) IsSet = true; Value = value; } + + /// + /// Implicitly converts this option to the contained type + /// + /// + public static implicit operator TType(Option option) => option.Value; + + /// + /// Implicitly converts the provided value to an Option + /// + /// + public static implicit operator Option(TType value) => new Option(value); } } \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 42747dee35ea..2f454803efc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Activity : IValidatableObject /// /// activityOutputs [JsonConstructor] - public Activity(Dictionary> activityOutputs) + public Activity(Option>> activityOutputs = default) { - ActivityOutputs = activityOutputs; + ActivityOutputsOption = activityOutputs; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ActivityOutputs + /// + [JsonIgnore] + public Option>> ActivityOutputsOption { get; private set; } // option d + /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get; set; } + public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new Option>>(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary> activityOutputs = default; + Option>> activityOutputs = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv { case "activity_outputs": if (utf8JsonReader.TokenType != JsonTokenType.Null) - activityOutputs = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + activityOutputs = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (activityOutputs == null) - throw new ArgumentNullException(nameof(activityOutputs), "Property is required for class Activity."); + if (activityOutputs.IsSet && activityOutputs.Value == null) + throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); + return new Activity(activityOutputs); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, Activity activity, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("activity_outputs"); - JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) + throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); + + if (activity.ActivityOutputsOption.IsSet) // 14 + writer.WritePropertyName("activity_outputs"); + JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 233d362f51ed..0825c1699f7a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class ActivityOutputElementRepresentation : IValidatableObject /// prop1 /// prop2 [JsonConstructor] - public ActivityOutputElementRepresentation(string prop1, Object prop2) + public ActivityOutputElementRepresentation(Option prop1 = default, Option prop2 = default) { - Prop1 = prop1; - Prop2 = prop2; + Prop1Option = prop1; + Prop2Option = prop2; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Prop1 + /// + [JsonIgnore] + public Option Prop1Option { get; private set; } // option d + /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get; set; } + public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new Option(value); } } // d + + /// + /// Used to track the state of Prop2 + /// + [JsonIgnore] + public Option Prop2Option { get; private set; } // option d /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get; set; } + public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string prop1 = default; - Object prop2 = default; + Option prop1 = default; + Option prop2 = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 switch (localVarJsonPropertyName) { case "prop1": - prop1 = utf8JsonReader.GetString(); + prop1 = new Option(utf8JsonReader.GetString()); break; case "prop2": if (utf8JsonReader.TokenType != JsonTokenType.Null) - prop2 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + prop2 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -140,13 +153,13 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 } } - if (prop1 == null) - throw new ArgumentNullException(nameof(prop1), "Property is required for class ActivityOutputElementRepresentation."); + if (prop1.IsSet && prop1.Value == null) + throw new ArgumentNullException(nameof(prop1), "Property is not nullable for class ActivityOutputElementRepresentation."); - if (prop2 == null) - throw new ArgumentNullException(nameof(prop2), "Property is required for class ActivityOutputElementRepresentation."); + if (prop2.IsSet && prop2.Value == null) + throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); + return new ActivityOutputElementRepresentation(prop1, prop2); // a } /// @@ -173,9 +186,18 @@ public override void Write(Utf8JsonWriter writer, ActivityOutputElementRepresent /// public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepresentation activityOutputElementRepresentation, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - writer.WritePropertyName("prop2"); - JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + if (activityOutputElementRepresentation.Prop1Option.IsSet && activityOutputElementRepresentation.Prop1 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop1), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop2Option.IsSet && activityOutputElementRepresentation.Prop2 == null) + throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); + + if (activityOutputElementRepresentation.Prop1Option.IsSet) + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + + if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + writer.WritePropertyName("prop2"); + JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index ed15d711b7a7..8f164acbc1fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -40,69 +41,117 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesString /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Object emptyMap, Dictionary> mapOfMapProperty, Dictionary mapProperty, Object mapWithUndeclaredPropertiesAnytype1, Object mapWithUndeclaredPropertiesAnytype2, Dictionary mapWithUndeclaredPropertiesAnytype3, Dictionary mapWithUndeclaredPropertiesString, Object anytype1 = default) + public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) { - EmptyMap = emptyMap; - MapOfMapProperty = mapOfMapProperty; - MapProperty = mapProperty; - MapWithUndeclaredPropertiesAnytype1 = mapWithUndeclaredPropertiesAnytype1; - MapWithUndeclaredPropertiesAnytype2 = mapWithUndeclaredPropertiesAnytype2; - MapWithUndeclaredPropertiesAnytype3 = mapWithUndeclaredPropertiesAnytype3; - MapWithUndeclaredPropertiesString = mapWithUndeclaredPropertiesString; - Anytype1 = anytype1; + EmptyMapOption = emptyMap; + MapOfMapPropertyOption = mapOfMapProperty; + MapPropertyOption = mapProperty; + MapWithUndeclaredPropertiesAnytype1Option = mapWithUndeclaredPropertiesAnytype1; + MapWithUndeclaredPropertiesAnytype2Option = mapWithUndeclaredPropertiesAnytype2; + MapWithUndeclaredPropertiesAnytype3Option = mapWithUndeclaredPropertiesAnytype3; + MapWithUndeclaredPropertiesStringOption = mapWithUndeclaredPropertiesString; + Anytype1Option = anytype1; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EmptyMap + /// + [JsonIgnore] + public Option EmptyMapOption { get; private set; } // option d + /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get; set; } + public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new Option(value); } } // d + + /// + /// Used to track the state of MapOfMapProperty + /// + [JsonIgnore] + public Option>> MapOfMapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get; set; } + public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new Option>>(value); } } // d + + /// + /// Used to track the state of MapProperty + /// + [JsonIgnore] + public Option> MapPropertyOption { get; private set; } // option d /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get; set; } + public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new Option>(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new Option(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 + /// + [JsonIgnore] + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get; set; } + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new Option(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 + /// + [JsonIgnore] + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get; set; } + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new Option>(value); } } // d + + /// + /// Used to track the state of MapWithUndeclaredPropertiesString + /// + [JsonIgnore] + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get; set; } + public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new Option>(value); } } // d + + /// + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + public Option Anytype1Option { get; private set; } // option d /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get; set; } + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -164,14 +213,14 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Object emptyMap = default; - Dictionary> mapOfMapProperty = default; - Dictionary mapProperty = default; - Object mapWithUndeclaredPropertiesAnytype1 = default; - Object mapWithUndeclaredPropertiesAnytype2 = default; - Dictionary mapWithUndeclaredPropertiesAnytype3 = default; - Dictionary mapWithUndeclaredPropertiesString = default; - Object anytype1 = default; + Option emptyMap = default; + Option>> mapOfMapProperty = default; + Option> mapProperty = default; + Option mapWithUndeclaredPropertiesAnytype1 = default; + Option mapWithUndeclaredPropertiesAnytype2 = default; + Option> mapWithUndeclaredPropertiesAnytype3 = default; + Option> mapWithUndeclaredPropertiesString = default; + Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -190,35 +239,35 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader { case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - emptyMap = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + mapOfMapProperty = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "map_property": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mapProperty = 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 = 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 = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "anytype_1": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -226,28 +275,28 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader } } - if (emptyMap == null) - throw new ArgumentNullException(nameof(emptyMap), "Property is required for class AdditionalPropertiesClass."); + if (emptyMap.IsSet && emptyMap.Value == null) + throw new ArgumentNullException(nameof(emptyMap), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapOfMapProperty == null) - throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapOfMapProperty.IsSet && mapOfMapProperty.Value == null) + throw new ArgumentNullException(nameof(mapOfMapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapProperty == null) - throw new ArgumentNullException(nameof(mapProperty), "Property is required for class AdditionalPropertiesClass."); + if (mapProperty.IsSet && mapProperty.Value == null) + throw new ArgumentNullException(nameof(mapProperty), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype1 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype1.IsSet && mapWithUndeclaredPropertiesAnytype1.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype1), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype2 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype2.IsSet && mapWithUndeclaredPropertiesAnytype2.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype2), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesAnytype3 == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesAnytype3.IsSet && mapWithUndeclaredPropertiesAnytype3.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesAnytype3), "Property is not nullable for class AdditionalPropertiesClass."); - if (mapWithUndeclaredPropertiesString == null) - throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) + throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a } /// @@ -274,22 +323,56 @@ public override void Write(Utf8JsonWriter writer, AdditionalPropertiesClass addi /// public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass additionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("empty_map"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - writer.WritePropertyName("map_of_map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_property"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - writer.WritePropertyName("map_with_undeclared_properties_string"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + if (additionalPropertiesClass.EmptyMapOption.IsSet && additionalPropertiesClass.EmptyMap == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.EmptyMap), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet && additionalPropertiesClass.MapOfMapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapOfMapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapPropertyOption.IsSet && additionalPropertiesClass.MapProperty == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapProperty), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3 == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) + throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + + if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + writer.WritePropertyName("empty_map"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_of_map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + writer.WritePropertyName("map_property"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + writer.WritePropertyName("map_with_undeclared_properties_string"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 460543ebf0df..f17ad63bb343 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class Animal : IValidatableObject /// className /// color (default to "red") [JsonConstructor] - public Animal(string className, string color = @"red") + public Animal(string className, Option color = default) { ClassName = className; - Color = color; + ColorOption = color; OnCreated(); } @@ -47,13 +48,19 @@ public Animal(string className, string color = @"red") /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -119,8 +126,8 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - string color = default; + Option className = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -138,10 +145,10 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -149,13 +156,16 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Animal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Animal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Animal."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Animal."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className, color); + return new Animal(className.Value, color); // a } /// @@ -182,8 +192,16 @@ public override void Write(Utf8JsonWriter writer, Animal animal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", animal.ClassName); - writer.WriteString("color", animal.Color); + if (animal.ClassName == null) + throw new ArgumentNullException(nameof(animal.ClassName), "Property is required for class Animal."); + + if (animal.ColorOption.IsSet && animal.Color == null) + throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); + + writer.WriteString("className", animal.ClassName); // 1 + + if (animal.ColorOption.IsSet) + writer.WriteString("color", animal.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 5a7be95495cc..ebdc8b4fc4ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class ApiResponse : IValidatableObject /// message /// type [JsonConstructor] - public ApiResponse(int code, string message, string type) + public ApiResponse(Option code = default, Option message = default, Option type = default) { - Code = code; - Message = message; - Type = type; + CodeOption = code; + MessageOption = message; + TypeOption = type; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Code + /// + [JsonIgnore] + public Option CodeOption { get; private set; } // option d + /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int Code { get; set; } + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new Option(value); } } // d + + /// + /// Used to track the state of Message + /// + [JsonIgnore] + public Option MessageOption { get; private set; } // option d /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get; set; } + public string Message { get { return this. MessageOption; } set { this.MessageOption = new Option(value); } } // d + + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option d /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get; set; } + public string Type { get { return this. TypeOption; } set { this.TypeOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? code = default; - string message = default; - string type = default; + Option code = default; + Option message = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -139,13 +158,13 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC { case "code": if (utf8JsonReader.TokenType != JsonTokenType.Null) - code = utf8JsonReader.GetInt32(); + code = new Option(utf8JsonReader.GetInt32()); break; case "message": - message = utf8JsonReader.GetString(); + message = new Option(utf8JsonReader.GetString()); break; case "type": - type = utf8JsonReader.GetString(); + type = new Option(utf8JsonReader.GetString()); break; default: break; @@ -153,16 +172,16 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (code == null) - throw new ArgumentNullException(nameof(code), "Property is required for class ApiResponse."); + if (code.IsSet && code.Value == null) + throw new ArgumentNullException(nameof(code), "Property is not nullable for class ApiResponse."); - if (message == null) - throw new ArgumentNullException(nameof(message), "Property is required for class ApiResponse."); + if (message.IsSet && message.Value == null) + throw new ArgumentNullException(nameof(message), "Property is not nullable for class ApiResponse."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class ApiResponse."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code.Value, message, type); + return new ApiResponse(code, message, type); // a } /// @@ -189,9 +208,20 @@ public override void Write(Utf8JsonWriter writer, ApiResponse apiResponse, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("code", apiResponse.Code); - writer.WriteString("message", apiResponse.Message); - writer.WriteString("type", apiResponse.Type); + if (apiResponse.MessageOption.IsSet && apiResponse.Message == null) + throw new ArgumentNullException(nameof(apiResponse.Message), "Property is required for class ApiResponse."); + + if (apiResponse.TypeOption.IsSet && apiResponse.Type == null) + throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); + + if (apiResponse.CodeOption.IsSet) + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); // 3 + + if (apiResponse.MessageOption.IsSet) + writer.WriteString("message", apiResponse.Message); // 1 + + if (apiResponse.TypeOption.IsSet) + writer.WriteString("type", apiResponse.Type); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 31246df0422a..5d56ab65fcd2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class Apple : IValidatableObject /// cultivar /// origin [JsonConstructor] - public Apple(string colorCode, string cultivar, string origin) + public Apple(Option colorCode = default, Option cultivar = default, Option origin = default) { - ColorCode = colorCode; - Cultivar = cultivar; - Origin = origin; + ColorCodeOption = colorCode; + CultivarOption = cultivar; + OriginOption = origin; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ColorCode + /// + [JsonIgnore] + public Option ColorCodeOption { get; private set; } // option d + /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get; set; } + public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new Option(value); } } // d + + /// + /// Used to track the state of Cultivar + /// + [JsonIgnore] + public Option CultivarOption { get; private set; } // option d /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new Option(value); } } // d + + /// + /// Used to track the state of Origin + /// + [JsonIgnore] + public Option OriginOption { get; private set; } // option d /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get; set; } + public string Origin { get { return this. OriginOption; } set { this.OriginOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -92,28 +111,31 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - if (this.ColorCode != null) { + if (this.ColorCodeOption.Value != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + + if (this.ColorCodeOption.Value != null &&!regexColorCode.Match(this.ColorCodeOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } } - if (this.Cultivar != null) { + if (this.CultivarOption.Value != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + + if (this.CultivarOption.Value != null &&!regexCultivar.Match(this.CultivarOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } } - if (this.Origin != null) { + if (this.OriginOption.Value != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + + if (this.OriginOption.Value != null &&!regexOrigin.Match(this.OriginOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } @@ -145,9 +167,9 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string colorCode = default; - string cultivar = default; - string origin = default; + Option colorCode = default; + Option cultivar = default; + Option origin = default; while (utf8JsonReader.Read()) { @@ -165,13 +187,13 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color_code": - colorCode = utf8JsonReader.GetString(); + colorCode = new Option(utf8JsonReader.GetString()); break; case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "origin": - origin = utf8JsonReader.GetString(); + origin = new Option(utf8JsonReader.GetString()); break; default: break; @@ -179,16 +201,16 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (colorCode == null) - throw new ArgumentNullException(nameof(colorCode), "Property is required for class Apple."); + if (colorCode.IsSet && colorCode.Value == null) + throw new ArgumentNullException(nameof(colorCode), "Property is not nullable for class Apple."); - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class Apple."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class Apple."); - if (origin == null) - throw new ArgumentNullException(nameof(origin), "Property is required for class Apple."); + if (origin.IsSet && origin.Value == null) + throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); + return new Apple(colorCode, cultivar, origin); // a } /// @@ -215,9 +237,23 @@ public override void Write(Utf8JsonWriter writer, Apple apple, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color_code", apple.ColorCode); - writer.WriteString("cultivar", apple.Cultivar); - writer.WriteString("origin", apple.Origin); + if (apple.ColorCodeOption.IsSet && apple.ColorCode == null) + throw new ArgumentNullException(nameof(apple.ColorCode), "Property is required for class Apple."); + + if (apple.CultivarOption.IsSet && apple.Cultivar == null) + throw new ArgumentNullException(nameof(apple.Cultivar), "Property is required for class Apple."); + + if (apple.OriginOption.IsSet && apple.Origin == null) + throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); + + if (apple.ColorCodeOption.IsSet) + writer.WriteString("color_code", apple.ColorCode); // 1 + + if (apple.CultivarOption.IsSet) + writer.WriteString("cultivar", apple.Cultivar); // 1 + + if (apple.OriginOption.IsSet) + writer.WriteString("origin", apple.Origin); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index e0882d925c5d..b2f893aa320d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class AppleReq : IValidatableObject /// cultivar /// mealy [JsonConstructor] - public AppleReq(string cultivar, bool mealy) + public AppleReq(string cultivar, Option mealy = default) { Cultivar = cultivar; - Mealy = mealy; + MealyOption = mealy; OnCreated(); } @@ -47,13 +48,19 @@ public AppleReq(string cultivar, bool mealy) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } + public string Cultivar { get; set; } // d + + /// + /// Used to track the state of Mealy + /// + [JsonIgnore] + public Option MealyOption { get; private set; } // option d /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool Mealy { get; set; } + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -102,8 +109,8 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string cultivar = default; - bool? mealy = default; + Option cultivar = default; + Option mealy = default; while (utf8JsonReader.Read()) { @@ -121,11 +128,11 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "cultivar": - cultivar = utf8JsonReader.GetString(); + cultivar = new Option(utf8JsonReader.GetString()); break; case "mealy": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mealy = utf8JsonReader.GetBoolean(); + mealy = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -133,13 +140,16 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (cultivar == null) - throw new ArgumentNullException(nameof(cultivar), "Property is required for class AppleReq."); + if (!cultivar.IsSet) + throw new ArgumentException("Property is required for class AppleReq.", nameof(cultivar)); - if (mealy == null) - throw new ArgumentNullException(nameof(mealy), "Property is required for class AppleReq."); + if (cultivar.IsSet && cultivar.Value == null) + throw new ArgumentNullException(nameof(cultivar), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar, mealy.Value); + if (mealy.IsSet && mealy.Value == null) + throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); + + return new AppleReq(cultivar.Value, mealy); // a } /// @@ -166,8 +176,13 @@ public override void Write(Utf8JsonWriter writer, AppleReq appleReq, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("cultivar", appleReq.Cultivar); - writer.WriteBoolean("mealy", appleReq.Mealy); + if (appleReq.Cultivar == null) + throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); + + writer.WriteString("cultivar", appleReq.Cultivar); // 1 + + if (appleReq.MealyOption.IsSet) + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 6fc0afdbc300..a5171f72300f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ArrayOfArrayOfNumberOnly : IValidatableObject /// /// arrayArrayNumber [JsonConstructor] - public ArrayOfArrayOfNumberOnly(List> arrayArrayNumber) + public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = default) { - ArrayArrayNumber = arrayArrayNumber; + ArrayArrayNumberOption = arrayArrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayNumber + /// + [JsonIgnore] + public Option>> ArrayArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get; set; } + public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new Option>>(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayNumber = default; + Option>> arrayArrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, { case "ArrayArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayNumber = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayNumber = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, } } - if (arrayArrayNumber == null) - throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly array /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); + + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 0715a3fdf65f..c9ca0a5026d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ArrayOfNumberOnly : IValidatableObject /// /// arrayNumber [JsonConstructor] - public ArrayOfNumberOnly(List arrayNumber) + public ArrayOfNumberOnly(Option> arrayNumber = default) { - ArrayNumber = arrayNumber; + ArrayNumberOption = arrayNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayNumber + /// + [JsonIgnore] + public Option> ArrayNumberOption { get; private set; } // option d + /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get; set; } + public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayNumber = default; + Option> arrayNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t { case "ArrayNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNumber = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNumber = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (arrayNumber == null) - throw new ArgumentNullException(nameof(arrayNumber), "Property is required for class ArrayOfNumberOnly."); + if (arrayNumber.IsSet && arrayNumber.Value == null) + throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); + return new ArrayOfNumberOnly(arrayNumber); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumbe /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOfNumberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("ArrayNumber"); - JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) + throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); + + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + writer.WritePropertyName("ArrayNumber"); + JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 43088ca1d97b..6590004582a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class ArrayTest : IValidatableObject /// arrayArrayOfModel /// arrayOfString [JsonConstructor] - public ArrayTest(List> arrayArrayOfInteger, List> arrayArrayOfModel, List arrayOfString) + public ArrayTest(Option>> arrayArrayOfInteger = default, Option>> arrayArrayOfModel = default, Option> arrayOfString = default) { - ArrayArrayOfInteger = arrayArrayOfInteger; - ArrayArrayOfModel = arrayArrayOfModel; - ArrayOfString = arrayOfString; + ArrayArrayOfIntegerOption = arrayArrayOfInteger; + ArrayArrayOfModelOption = arrayArrayOfModel; + ArrayOfStringOption = arrayOfString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayArrayOfInteger + /// + [JsonIgnore] + public Option>> ArrayArrayOfIntegerOption { get; private set; } // option d + /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get; set; } + public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new Option>>(value); } } // d + + /// + /// Used to track the state of ArrayArrayOfModel + /// + [JsonIgnore] + public Option>> ArrayArrayOfModelOption { get; private set; } // option d /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get; set; } + public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new Option>>(value); } } // d + + /// + /// Used to track the state of ArrayOfString + /// + [JsonIgnore] + public Option> ArrayOfStringOption { get; private set; } // option d /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get; set; } + public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> arrayArrayOfInteger = default; - List> arrayArrayOfModel = default; - List arrayOfString = default; + Option>> arrayArrayOfInteger = default; + Option>> arrayArrayOfModel = default; + Option> arrayOfString = default; while (utf8JsonReader.Read()) { @@ -139,15 +158,15 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "array_array_of_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayArrayOfInteger = 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 = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + arrayArrayOfModel = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayOfString = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -155,16 +174,16 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (arrayArrayOfInteger == null) - throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is required for class ArrayTest."); + if (arrayArrayOfInteger.IsSet && arrayArrayOfInteger.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfInteger), "Property is not nullable for class ArrayTest."); - if (arrayArrayOfModel == null) - throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is required for class ArrayTest."); + if (arrayArrayOfModel.IsSet && arrayArrayOfModel.Value == null) + throw new ArgumentNullException(nameof(arrayArrayOfModel), "Property is not nullable for class ArrayTest."); - if (arrayOfString == null) - throw new ArgumentNullException(nameof(arrayOfString), "Property is required for class ArrayTest."); + if (arrayOfString.IsSet && arrayOfString.Value == null) + throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a } /// @@ -191,12 +210,24 @@ public override void Write(Utf8JsonWriter writer, ArrayTest arrayTest, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_array_of_integer"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - writer.WritePropertyName("array_array_of_model"); - JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - writer.WritePropertyName("array_of_string"); - JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfIntegerOption.IsSet && arrayTest.ArrayArrayOfInteger == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfInteger), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfModelOption.IsSet && arrayTest.ArrayArrayOfModel == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayArrayOfModel), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) + throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); + + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_integer"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + writer.WritePropertyName("array_array_of_model"); + JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + if (arrayTest.ArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("array_of_string"); + JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs index 75bab7a8d056..8f7a0b09b831 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Banana : IValidatableObject /// /// lengthCm [JsonConstructor] - public Banana(decimal lengthCm) + public Banana(Option lengthCm = default) { - LengthCm = lengthCm; + LengthCmOption = lengthCm; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of LengthCm + /// + [JsonIgnore] + public Option LengthCmOption { get; private set; } // option d + /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; + Option lengthCm = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +134,10 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class Banana."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm.Value); + return new Banana(lengthCm); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", banana.LengthCm); + if (banana.LengthCmOption.IsSet) + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index 61e5cf312cca..db117e6c6dbc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class BananaReq : IValidatableObject /// lengthCm /// sweet [JsonConstructor] - public BananaReq(decimal lengthCm, bool sweet) + public BananaReq(decimal lengthCm, Option sweet = default) { LengthCm = lengthCm; - Sweet = sweet; + SweetOption = sweet; OnCreated(); } @@ -47,13 +48,19 @@ public BananaReq(decimal lengthCm, bool sweet) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } + public decimal LengthCm { get; set; } // d + + /// + /// Used to track the state of Sweet + /// + [JsonIgnore] + public Option SweetOption { get; private set; } // option d /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool Sweet { get; set; } + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -102,8 +109,8 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? lengthCm = default; - bool? sweet = default; + Option lengthCm = default; + Option sweet = default; while (utf8JsonReader.Read()) { @@ -122,11 +129,11 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon { case "lengthCm": if (utf8JsonReader.TokenType != JsonTokenType.Null) - lengthCm = utf8JsonReader.GetDecimal(); + lengthCm = new Option(utf8JsonReader.GetDecimal()); break; case "sweet": if (utf8JsonReader.TokenType != JsonTokenType.Null) - sweet = utf8JsonReader.GetBoolean(); + sweet = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -134,13 +141,16 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (lengthCm == null) - throw new ArgumentNullException(nameof(lengthCm), "Property is required for class BananaReq."); + if (!lengthCm.IsSet) + throw new ArgumentException("Property is required for class BananaReq.", nameof(lengthCm)); - if (sweet == null) - throw new ArgumentNullException(nameof(sweet), "Property is required for class BananaReq."); + if (lengthCm.IsSet && lengthCm.Value == null) + throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value, sweet.Value); + if (sweet.IsSet && sweet.Value == null) + throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); + + return new BananaReq(lengthCm.Value.Value, sweet); // a } /// @@ -167,8 +177,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); - writer.WriteBoolean("sweet", bananaReq.Sweet); + writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + + if (bananaReq.SweetOption.IsSet) + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs index c9e4a8bc7120..3c2aaf08e492 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class BasquePig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class BasquePig.", nameof(className)); - return new BasquePig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); + + return new BasquePig(className.Value); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, BasquePig basquePig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", basquePig.ClassName); + if (basquePig.ClassName == null) + throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); + + writer.WriteString("className", basquePig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index ca7eb413c65b..6ccc5da39b24 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,55 +39,91 @@ public partial class Capitalization : IValidatableObject /// smallCamel /// smallSnake [JsonConstructor] - public Capitalization(string aTTNAME, string capitalCamel, string capitalSnake, string sCAETHFlowPoints, string smallCamel, string smallSnake) + public Capitalization(Option aTTNAME = default, Option capitalCamel = default, Option capitalSnake = default, Option sCAETHFlowPoints = default, Option smallCamel = default, Option smallSnake = default) { - ATT_NAME = aTTNAME; - CapitalCamel = capitalCamel; - CapitalSnake = capitalSnake; - SCAETHFlowPoints = sCAETHFlowPoints; - SmallCamel = smallCamel; - SmallSnake = smallSnake; + ATT_NAMEOption = aTTNAME; + CapitalCamelOption = capitalCamel; + CapitalSnakeOption = capitalSnake; + SCAETHFlowPointsOption = sCAETHFlowPoints; + SmallCamelOption = smallCamel; + SmallSnakeOption = smallSnake; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ATT_NAME + /// + [JsonIgnore] + public Option ATT_NAMEOption { get; private set; } // option d + /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get; set; } + public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new Option(value); } } // d + + /// + /// Used to track the state of CapitalCamel + /// + [JsonIgnore] + public Option CapitalCamelOption { get; private set; } // option d /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get; set; } + public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new Option(value); } } // d + + /// + /// Used to track the state of CapitalSnake + /// + [JsonIgnore] + public Option CapitalSnakeOption { get; private set; } // option d /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get; set; } + public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new Option(value); } } // d + + /// + /// Used to track the state of SCAETHFlowPoints + /// + [JsonIgnore] + public Option SCAETHFlowPointsOption { get; private set; } // option d /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get; set; } + public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new Option(value); } } // d + + /// + /// Used to track the state of SmallCamel + /// + [JsonIgnore] + public Option SmallCamelOption { get; private set; } // option d /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get; set; } + public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new Option(value); } } // d + + /// + /// Used to track the state of SmallSnake + /// + [JsonIgnore] + public Option SmallSnakeOption { get; private set; } // option d /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get; set; } + public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -146,12 +183,12 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string aTTNAME = default; - string capitalCamel = default; - string capitalSnake = default; - string sCAETHFlowPoints = default; - string smallCamel = default; - string smallSnake = default; + Option aTTNAME = default; + Option capitalCamel = default; + Option capitalSnake = default; + Option sCAETHFlowPoints = default; + Option smallCamel = default; + Option smallSnake = default; while (utf8JsonReader.Read()) { @@ -169,22 +206,22 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "ATT_NAME": - aTTNAME = utf8JsonReader.GetString(); + aTTNAME = new Option(utf8JsonReader.GetString()); break; case "CapitalCamel": - capitalCamel = utf8JsonReader.GetString(); + capitalCamel = new Option(utf8JsonReader.GetString()); break; case "Capital_Snake": - capitalSnake = utf8JsonReader.GetString(); + capitalSnake = new Option(utf8JsonReader.GetString()); break; case "SCA_ETH_Flow_Points": - sCAETHFlowPoints = utf8JsonReader.GetString(); + sCAETHFlowPoints = new Option(utf8JsonReader.GetString()); break; case "smallCamel": - smallCamel = utf8JsonReader.GetString(); + smallCamel = new Option(utf8JsonReader.GetString()); break; case "small_Snake": - smallSnake = utf8JsonReader.GetString(); + smallSnake = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,25 +229,25 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (aTTNAME == null) - throw new ArgumentNullException(nameof(aTTNAME), "Property is required for class Capitalization."); + if (aTTNAME.IsSet && aTTNAME.Value == null) + throw new ArgumentNullException(nameof(aTTNAME), "Property is not nullable for class Capitalization."); - if (capitalCamel == null) - throw new ArgumentNullException(nameof(capitalCamel), "Property is required for class Capitalization."); + if (capitalCamel.IsSet && capitalCamel.Value == null) + throw new ArgumentNullException(nameof(capitalCamel), "Property is not nullable for class Capitalization."); - if (capitalSnake == null) - throw new ArgumentNullException(nameof(capitalSnake), "Property is required for class Capitalization."); + if (capitalSnake.IsSet && capitalSnake.Value == null) + throw new ArgumentNullException(nameof(capitalSnake), "Property is not nullable for class Capitalization."); - if (sCAETHFlowPoints == null) - throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is required for class Capitalization."); + if (sCAETHFlowPoints.IsSet && sCAETHFlowPoints.Value == null) + throw new ArgumentNullException(nameof(sCAETHFlowPoints), "Property is not nullable for class Capitalization."); - if (smallCamel == null) - throw new ArgumentNullException(nameof(smallCamel), "Property is required for class Capitalization."); + if (smallCamel.IsSet && smallCamel.Value == null) + throw new ArgumentNullException(nameof(smallCamel), "Property is not nullable for class Capitalization."); - if (smallSnake == null) - throw new ArgumentNullException(nameof(smallSnake), "Property is required for class Capitalization."); + if (smallSnake.IsSet && smallSnake.Value == null) + throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a } /// @@ -237,12 +274,41 @@ public override void Write(Utf8JsonWriter writer, Capitalization capitalization, /// public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitalization, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); - writer.WriteString("smallCamel", capitalization.SmallCamel); - writer.WriteString("small_Snake", capitalization.SmallSnake); + if (capitalization.ATT_NAMEOption.IsSet && capitalization.ATT_NAME == null) + throw new ArgumentNullException(nameof(capitalization.ATT_NAME), "Property is required for class Capitalization."); + + if (capitalization.CapitalCamelOption.IsSet && capitalization.CapitalCamel == null) + throw new ArgumentNullException(nameof(capitalization.CapitalCamel), "Property is required for class Capitalization."); + + if (capitalization.CapitalSnakeOption.IsSet && capitalization.CapitalSnake == null) + throw new ArgumentNullException(nameof(capitalization.CapitalSnake), "Property is required for class Capitalization."); + + if (capitalization.SCAETHFlowPointsOption.IsSet && capitalization.SCAETHFlowPoints == null) + throw new ArgumentNullException(nameof(capitalization.SCAETHFlowPoints), "Property is required for class Capitalization."); + + if (capitalization.SmallCamelOption.IsSet && capitalization.SmallCamel == null) + throw new ArgumentNullException(nameof(capitalization.SmallCamel), "Property is required for class Capitalization."); + + if (capitalization.SmallSnakeOption.IsSet && capitalization.SmallSnake == null) + throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); + + if (capitalization.ATT_NAMEOption.IsSet) + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + + if (capitalization.CapitalCamelOption.IsSet) + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + + if (capitalization.CapitalSnakeOption.IsSet) + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + + if (capitalization.SCAETHFlowPointsOption.IsSet) + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + + if (capitalization.SmallCamelOption.IsSet) + writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + + if (capitalization.SmallSnakeOption.IsSet) + writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 619fc52ce11c..fdc2d8924db2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,19 +36,25 @@ public partial class Cat : Animal, IValidatableObject /// declawed /// color (default to "red") [JsonConstructor] - public Cat(string className, bool declawed, string color = @"red") : base(className, color) + public Cat(string className, Option declawed = default, Option color = default) : base(className, color) { - Declawed = declawed; + DeclawedOption = declawed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Declawed + /// + [JsonIgnore] + public Option DeclawedOption { get; private set; } // option d + /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool Declawed { get; set; } + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -86,9 +93,9 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? declawed = default; - string color = default; + Option className = default; + Option declawed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -106,14 +113,14 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) - declawed = utf8JsonReader.GetBoolean(); + declawed = new Option(utf8JsonReader.GetBoolean()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -121,16 +128,19 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Cat."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Cat.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed == null) - throw new ArgumentNullException(nameof(declawed), "Property is required for class Cat."); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Cat."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className, declawed.Value, color); + return new Cat(className.Value, declawed, color); // a } /// @@ -157,9 +167,19 @@ public override void Write(Utf8JsonWriter writer, Cat cat, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", cat.ClassName); - writer.WriteBoolean("declawed", cat.Declawed); - writer.WriteString("color", cat.Color); + if (cat.ClassName == null) + throw new ArgumentNullException(nameof(cat.ClassName), "Property is required for class Cat."); + + if (cat.ColorOption.IsSet && cat.Color == null) + throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); + + writer.WriteString("className", cat.ClassName); // 1 + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); // 2 + + if (cat.ColorOption.IsSet) + writer.WriteString("color", cat.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 6139c3048390..064beb238cca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,29 +32,35 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// id /// name (default to "default-name") + /// id [JsonConstructor] - public Category(long id, string name = @"default-name") + public Category(string name = @"default-name", Option id = default) { - Id = id; Name = name; + IdOption = id; OnCreated(); } partial void OnCreated(); /// - /// Gets or Sets Id + /// Gets or Sets Name /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonPropertyName("name")] + public string Name { get; set; } // d /// - /// Gets or Sets Name + /// Used to track the state of Id /// - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d + + /// + /// Gets or Sets Id + /// + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -69,8 +76,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -109,8 +116,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option name = default; + Option id = default; while (utf8JsonReader.Read()) { @@ -127,12 +134,12 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "name": + name = new Option(utf8JsonReader.GetString()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); - break; - case "name": - name = utf8JsonReader.GetString(); + id = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +147,16 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Category."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Category.", nameof(name)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Category."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(id.Value, name); + return new Category(name.Value, id); // a } /// @@ -173,8 +183,13 @@ public override void Write(Utf8JsonWriter writer, Category category, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", category.Id); - writer.WriteString("name", category.Name); + if (category.Name == null) + throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); + + writer.WriteString("name", category.Name); // 1 + + if (category.IdOption.IsSet) + writer.WriteNumber("id", category.IdOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index a32821259868..c220fd2fdbe3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class ChildCat : ParentPet, IValidatableObject /// name /// petType (default to PetTypeEnum.ChildCat) [JsonConstructor] - public ChildCat(string name, PetTypeEnum petType = PetTypeEnum.ChildCat) : base(ChildCat.PetTypeEnumToJsonValue(petType)) + public ChildCat(Option name = default, Option petType = default) : base(ChildCat.PetTypeEnumToJsonValue(petType.Value)) { - Name = name; - PetType = petType; + NameOption = name; + PetTypeOption = petType; OnCreated(); } @@ -87,26 +88,37 @@ public static PetTypeEnum PetTypeEnumFromString(string value) /// /// /// - public static string PetTypeEnumToJsonValue(PetTypeEnum value) + public static string PetTypeEnumToJsonValue(PetTypeEnum? value) { - if (value == PetTypeEnum.ChildCat) return "ChildCat"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of PetType + /// + [JsonIgnore] + public new Option PetTypeOption { get; private set; } // option a + /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum PetType { get; set; } + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new Option(value); } } // a + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -146,8 +158,8 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; - ChildCat.PetTypeEnum? petType = default; + Option name = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -165,13 +177,12 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; case "pet_type": string petTypeRawValue = utf8JsonReader.GetString(); - petType = petTypeRawValue == null - ? null - : ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue); + if (petTypeRawValue != null) + petType = new Option(ChildCat.PetTypeEnumFromStringOrDefault(petTypeRawValue)); break; default: break; @@ -179,13 +190,13 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class ChildCat."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class ChildCat."); - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ChildCat."); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType.Value); + return new ChildCat(name, petType); // a } /// @@ -212,9 +223,13 @@ public override void Write(Utf8JsonWriter writer, ChildCat childCat, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", childCat.Name); + if (childCat.NameOption.IsSet && childCat.Name == null) + throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); + + if (childCat.NameOption.IsSet) + writer.WriteString("name", childCat.Name); // 1 - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetType); + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); // 7 if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index d1c65d368199..87e9d678a638 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ClassModel : IValidatableObject /// /// varClass [JsonConstructor] - public ClassModel(string varClass) + public ClassModel(Option varClass = default) { - VarClass = varClass; + VarClassOption = varClass; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get; set; } + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; + Option varClass = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { case "_class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class ClassModel."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); + return new ClassModel(varClass); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, ClassModel classModel, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_class", classModel.VarClass); + if (classModel.VarClassOption.IsSet && classModel.VarClass == null) + throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); + + if (classModel.VarClassOption.IsSet) + writer.WriteString("_class", classModel.VarClass); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 79579247f7e9..2ba439964da6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class ComplexQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ComplexQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ComplexQuadrilateral.", nameof(shapeType)); - return new ComplexQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class ComplexQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); + + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, ComplexQuadrilateral complexQu /// public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral complexQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); + if (complexQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.QuadrilateralType), "Property is required for class ComplexQuadrilateral."); + + if (complexQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); + + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs index 84439210bcfc..2310e9adb29f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class DanishPig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class DanishPig.", nameof(className)); - return new DanishPig(className); + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); + + return new DanishPig(className.Value); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, DanishPig danishPig, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", danishPig.ClassName); + if (danishPig.ClassName == null) + throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); + + writer.WriteString("className", danishPig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 4420630af349..22f08d342b58 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class DateOnlyClass : IValidatableObject /// /// dateOnlyProperty [JsonConstructor] - public DateOnlyClass(DateTime dateOnlyProperty) + public DateOnlyClass(Option dateOnlyProperty = default) { - DateOnlyProperty = dateOnlyProperty; + DateOnlyPropertyOption = dateOnlyProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateOnlyProperty + /// + [JsonIgnore] + public Option DateOnlyPropertyOption { get; private set; } // option d + /// /// Gets or Sets DateOnlyProperty /// - /// Fri Jul 21 00:00:00 UTC 2017 + /// Thu Jul 20 20:00:00 EDT 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime DateOnlyProperty { get; set; } + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -106,7 +113,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateOnlyProperty = default; + Option dateOnlyProperty = default; while (utf8JsonReader.Read()) { @@ -125,7 +132,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "dateOnlyProperty": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateOnlyProperty = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateOnlyProperty = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -133,10 +140,10 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (dateOnlyProperty == null) - throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is required for class DateOnlyClass."); + if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) + throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty.Value); + return new DateOnlyClass(dateOnlyProperty); // a } /// @@ -163,7 +170,8 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyProperty.ToString(DateOnlyPropertyFormat)); + if (dateOnlyClass.DateOnlyPropertyOption.IsSet) + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); // 4 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 16e3dfe57faa..008923f6c6e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class DeprecatedObject : IValidatableObject /// /// name [JsonConstructor] - public DeprecatedObject(string name) + public DeprecatedObject(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class DeprecatedObject."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); + return new DeprecatedObject(name); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, DeprecatedObject deprecatedObj /// public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecatedObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", deprecatedObject.Name); + if (deprecatedObject.NameOption.IsSet && deprecatedObject.Name == null) + throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); + + if (deprecatedObject.NameOption.IsSet) + writer.WriteString("name", deprecatedObject.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 810934b95efe..57c61d2c5f46 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,23 +32,29 @@ public partial class Dog : Animal, IValidatableObject /// /// Initializes a new instance of the class. /// - /// breed /// className + /// breed /// color (default to "red") [JsonConstructor] - public Dog(string breed, string className, string color = @"red") : base(className, color) + public Dog(string className, Option breed = default, Option color = default) : base(className, color) { - Breed = breed; + BreedOption = breed; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Breed + /// + [JsonIgnore] + public Option BreedOption { get; private set; } // option d + /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get; set; } + public string Breed { get { return this. BreedOption; } set { this.BreedOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -86,9 +93,9 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string breed = default; - string className = default; - string color = default; + Option className = default; + Option breed = default; + Option color = default; while (utf8JsonReader.Read()) { @@ -105,14 +112,14 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "breed": - breed = utf8JsonReader.GetString(); - break; case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); + break; + case "breed": + breed = new Option(utf8JsonReader.GetString()); break; case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -120,16 +127,19 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (breed == null) - throw new ArgumentNullException(nameof(breed), "Property is required for class Dog."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Dog.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Dog."); - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Dog."); + if (breed.IsSet && breed.Value == null) + throw new ArgumentNullException(nameof(breed), "Property is not nullable for class Dog."); - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Dog."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(breed, className, color); + return new Dog(className.Value, breed, color); // a } /// @@ -156,9 +166,22 @@ public override void Write(Utf8JsonWriter writer, Dog dog, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("breed", dog.Breed); - writer.WriteString("className", dog.ClassName); - writer.WriteString("color", dog.Color); + if (dog.ClassName == null) + throw new ArgumentNullException(nameof(dog.ClassName), "Property is required for class Dog."); + + if (dog.BreedOption.IsSet && dog.Breed == null) + throw new ArgumentNullException(nameof(dog.Breed), "Property is required for class Dog."); + + if (dog.ColorOption.IsSet && dog.Color == null) + throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); + + writer.WriteString("className", dog.ClassName); // 1 + + if (dog.BreedOption.IsSet) + writer.WriteString("breed", dog.Breed); // 1 + + if (dog.ColorOption.IsSet) + writer.WriteString("color", dog.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 68f7676ff91f..49e9e932bde3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,40 +37,64 @@ public partial class Drawing : Dictionary, IValidatableObject /// nullableShape /// shapeOrNull [JsonConstructor] - public Drawing(Shape mainShape, List shapes, NullableShape nullableShape = default, ShapeOrNull shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() { - MainShape = mainShape; - Shapes = shapes; - NullableShape = nullableShape; - ShapeOrNull = shapeOrNull; + MainShapeOption = mainShape; + ShapesOption = shapes; + NullableShapeOption = nullableShape; + ShapeOrNullOption = shapeOrNull; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MainShape + /// + [JsonIgnore] + public Option MainShapeOption { get; private set; } // option d + /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get; set; } + public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new Option(value); } } // d + + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + public Option> ShapesOption { get; private set; } // option d /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get; set; } + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new Option>(value); } } // d + + /// + /// Used to track the state of NullableShape + /// + [JsonIgnore] + public Option NullableShapeOption { get; private set; } // option d /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get; set; } + public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new Option(value); } } // d + + /// + /// Used to track the state of ShapeOrNull + /// + [JsonIgnore] + public Option ShapeOrNullOption { get; private set; } // option d /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get; set; } + public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -138,10 +163,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Shape mainShape = default; - List shapes = default; - NullableShape nullableShape = default; - ShapeOrNull shapeOrNull = default; + Option mainShape = default; + Option> shapes = default; + Option nullableShape = default; + Option shapeOrNull = default; while (utf8JsonReader.Read()) { @@ -160,19 +185,19 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "mainShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - mainShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapes": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) - nullableShape = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "shapeOrNull": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapeOrNull = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -180,13 +205,13 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (mainShape == null) - throw new ArgumentNullException(nameof(mainShape), "Property is required for class Drawing."); + if (mainShape.IsSet && mainShape.Value == null) + throw new ArgumentNullException(nameof(mainShape), "Property is not nullable for class Drawing."); - if (shapes == null) - throw new ArgumentNullException(nameof(shapes), "Property is required for class Drawing."); + if (shapes.IsSet && shapes.Value == null) + throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a } /// @@ -213,14 +238,34 @@ public override void Write(Utf8JsonWriter writer, Drawing drawing, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("mainShape"); - JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - writer.WritePropertyName("nullableShape"); - JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); - writer.WritePropertyName("shapeOrNull"); - JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + if (drawing.MainShapeOption.IsSet && drawing.MainShape == null) + throw new ArgumentNullException(nameof(drawing.MainShape), "Property is required for class Drawing."); + + if (drawing.ShapesOption.IsSet && drawing.Shapes == null) + throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); + + if (drawing.MainShapeOption.IsSet) // 14 + writer.WritePropertyName("mainShape"); + JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + if (drawing.ShapesOption.IsSet) // 14 + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.Value != null) + { + writer.WritePropertyName("nullableShape"); + JsonSerializer.Serialize(writer, drawing.NullableShape, jsonSerializerOptions); + } + else + writer.WriteNull("nullableShape"); + if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.Value != null) + { + writer.WritePropertyName("shapeOrNull"); + JsonSerializer.Serialize(writer, drawing.ShapeOrNull, jsonSerializerOptions); + } + else + writer.WriteNull("shapeOrNull"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 58cf3e310f81..a12c39749cbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class EnumArrays : IValidatableObject /// arrayEnum /// justSymbol [JsonConstructor] - public EnumArrays(List arrayEnum, JustSymbolEnum justSymbol) + public EnumArrays(Option> arrayEnum = default, Option justSymbol = default) { - ArrayEnum = arrayEnum; - JustSymbol = justSymbol; + ArrayEnumOption = arrayEnum; + JustSymbolOption = justSymbol; OnCreated(); } @@ -100,7 +101,6 @@ public static ArrayEnumEnum ArrayEnumEnumFromString(string value) /// public static string ArrayEnumEnumToJsonValue(ArrayEnumEnum value) { - if (value == ArrayEnumEnum.Fish) return "fish"; @@ -165,9 +165,8 @@ public static JustSymbolEnum JustSymbolEnumFromString(string value) /// /// /// - public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) + public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) { - if (value == JustSymbolEnum.GreaterThanOrEqualTo) return ">="; @@ -177,17 +176,29 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of JustSymbol + /// + [JsonIgnore] + public Option JustSymbolOption { get; private set; } // option a + /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum JustSymbol { get; set; } + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new Option(value); } } // a + + /// + /// Used to track the state of ArrayEnum + /// + [JsonIgnore] + public Option> ArrayEnumOption { get; private set; } // option d /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get; set; } + public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -243,8 +254,8 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayEnum = default; - EnumArrays.JustSymbolEnum? justSymbol = default; + Option> arrayEnum = default; + Option justSymbol = default; while (utf8JsonReader.Read()) { @@ -263,13 +274,12 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "array_enum": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayEnum = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayEnum = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "just_symbol": string justSymbolRawValue = utf8JsonReader.GetString(); - justSymbol = justSymbolRawValue == null - ? null - : EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue); + if (justSymbolRawValue != null) + justSymbol = new Option(EnumArrays.JustSymbolEnumFromStringOrDefault(justSymbolRawValue)); break; default: break; @@ -277,13 +287,13 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (arrayEnum == null) - throw new ArgumentNullException(nameof(arrayEnum), "Property is required for class EnumArrays."); + if (arrayEnum.IsSet && arrayEnum.Value == null) + throw new ArgumentNullException(nameof(arrayEnum), "Property is not nullable for class EnumArrays."); - if (justSymbol == null) - throw new ArgumentNullException(nameof(justSymbol), "Property is required for class EnumArrays."); + if (justSymbol.IsSet && justSymbol.Value == null) + throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol.Value); + return new EnumArrays(arrayEnum, justSymbol); // a } /// @@ -310,10 +320,13 @@ public override void Write(Utf8JsonWriter writer, EnumArrays enumArrays, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_enum"); - JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) + throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbol); + if (enumArrays.ArrayEnumOption.IsSet) // 14 + writer.WritePropertyName("array_enum"); + JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); // 7 if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs index 94c2361c8810..b1aff0adf0d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index f3310c22a12b..fc7a9e9fc812 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,32 +32,188 @@ public partial class EnumTest : IValidatableObject /// /// Initializes a new instance of the class. /// + /// enumStringRequired /// enumInteger /// enumIntegerOnly /// enumNumber /// enumString - /// enumStringRequired /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue /// outerEnum [JsonConstructor] - public EnumTest(EnumIntegerEnum enumInteger, EnumIntegerOnlyEnum enumIntegerOnly, EnumNumberEnum enumNumber, EnumStringEnum enumString, EnumStringRequiredEnum enumStringRequired, OuterEnumDefaultValue outerEnumDefaultValue, OuterEnumInteger outerEnumInteger, OuterEnumIntegerDefaultValue outerEnumIntegerDefaultValue, OuterEnum? outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) { - EnumInteger = enumInteger; - EnumIntegerOnly = enumIntegerOnly; - EnumNumber = enumNumber; - EnumString = enumString; EnumStringRequired = enumStringRequired; - OuterEnumDefaultValue = outerEnumDefaultValue; - OuterEnumInteger = outerEnumInteger; - OuterEnumIntegerDefaultValue = outerEnumIntegerDefaultValue; - OuterEnum = outerEnum; + EnumIntegerOption = enumInteger; + EnumIntegerOnlyOption = enumIntegerOnly; + EnumNumberOption = enumNumber; + EnumStringOption = enumString; + OuterEnumDefaultValueOption = outerEnumDefaultValue; + OuterEnumIntegerOption = outerEnumInteger; + OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; + OuterEnumOption = outerEnum; OnCreated(); } partial void OnCreated(); + /// + /// Defines EnumStringRequired + /// + public enum EnumStringRequiredEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return EnumStringRequiredEnum.UPPER; + + if (value.Equals("lower")) + return EnumStringRequiredEnum.Lower; + + if (value.Equals("")) + return EnumStringRequiredEnum.Empty; + + if (value.Equals("Value\twith tab")) + return EnumStringRequiredEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return EnumStringRequiredEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return EnumStringRequiredEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return EnumStringRequiredEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) + { + if (value == EnumStringRequiredEnum.UPPER) + return "UPPER"; + + if (value == EnumStringRequiredEnum.Lower) + return "lower"; + + if (value == EnumStringRequiredEnum.Empty) + return ""; + + if (value == EnumStringRequiredEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == EnumStringRequiredEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == EnumStringRequiredEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == EnumStringRequiredEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets EnumStringRequired + /// + [JsonPropertyName("enum_string_required")] + public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + /// /// Defines EnumInteger /// @@ -116,11 +273,17 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) return (int) value; } + /// + /// Used to track the state of EnumInteger + /// + [JsonIgnore] + public Option EnumIntegerOption { get; private set; } // option a + /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum EnumInteger { get; set; } + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new Option(value); } } // a /// /// Defines EnumIntegerOnly @@ -181,11 +344,17 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) return (int) value; } + /// + /// Used to track the state of EnumIntegerOnly + /// + [JsonIgnore] + public Option EnumIntegerOnlyOption { get; private set; } // option a + /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum EnumIntegerOnly { get; set; } + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new Option(value); } } // a /// /// Defines EnumNumber @@ -242,9 +411,8 @@ public static EnumNumberEnum EnumNumberEnumFromString(string value) /// /// /// - public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) + public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) { - if (value == EnumNumberEnum.NUMBER_1_DOT_1) return 1.1; @@ -254,11 +422,17 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of EnumNumber + /// + [JsonIgnore] + public Option EnumNumberOption { get; private set; } // option a + /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum EnumNumber { get; set; } + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new Option(value); } } // a /// /// Defines EnumString @@ -381,9 +555,8 @@ public static EnumStringEnum EnumStringEnumFromString(string value) /// /// /// - public static string EnumStringEnumToJsonValue(EnumStringEnum value) + public static string EnumStringEnumToJsonValue(EnumStringEnum? value) { - if (value == EnumStringEnum.UPPER) return "UPPER"; @@ -412,191 +585,64 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum value) } /// - /// Gets or Sets EnumString + /// Used to track the state of EnumString /// - [JsonPropertyName("enum_string")] - public EnumStringEnum EnumString { get; set; } + [JsonIgnore] + public Option EnumStringOption { get; private set; } // option a /// - /// Defines EnumStringRequired + /// Gets or Sets EnumString /// - public enum EnumStringRequiredEnum - { - /// - /// Enum UPPER for value: UPPER - /// - UPPER = 1, - - /// - /// Enum Lower for value: lower - /// - Lower = 2, - - /// - /// Enum Empty for value: - /// - Empty = 3, - - /// - /// Enum ValuewithTab for value: Value\twith tab - /// - ValuewithTab = 4, - - /// - /// Enum ValueWithQuote for value: Value with \" quote - /// - ValueWithQuote = 5, - - /// - /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote - /// - ValueWithEscapedQuote = 6, - - /// - /// Enum Duplicatevalue for value: Duplicate\nvalue - /// - Duplicatevalue = 7, - - /// - /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue - /// - Duplicatevalue2 = 8 - } + [JsonPropertyName("enum_string")] + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new Option(value); } } // a /// - /// Returns a + /// Used to track the state of OuterEnumDefaultValue /// - /// - /// - /// - public static EnumStringRequiredEnum EnumStringRequiredEnumFromString(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - throw new NotImplementedException($"Could not convert value to type EnumStringRequiredEnum: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumDefaultValueOption { get; private set; } // option a /// - /// Returns a + /// Gets or Sets OuterEnumDefaultValue /// - /// - /// - public static EnumStringRequiredEnum? EnumStringRequiredEnumFromStringOrDefault(string value) - { - if (value.Equals("UPPER")) - return EnumStringRequiredEnum.UPPER; - - if (value.Equals("lower")) - return EnumStringRequiredEnum.Lower; - - if (value.Equals("")) - return EnumStringRequiredEnum.Empty; - - if (value.Equals("Value\twith tab")) - return EnumStringRequiredEnum.ValuewithTab; - - if (value.Equals("Value with \" quote")) - return EnumStringRequiredEnum.ValueWithQuote; - - if (value.Equals("Value with escaped \" quote")) - return EnumStringRequiredEnum.ValueWithEscapedQuote; - - if (value.Equals("Duplicate\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue; - - if (value.Equals("Duplicate\r\nvalue")) - return EnumStringRequiredEnum.Duplicatevalue2; - - return null; - } + [JsonPropertyName("outerEnumDefaultValue")] + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new Option(value); } } // a /// - /// Converts the to the json value + /// Used to track the state of OuterEnumInteger /// - /// - /// - /// - public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum value) - { - - if (value == EnumStringRequiredEnum.UPPER) - return "UPPER"; - - if (value == EnumStringRequiredEnum.Lower) - return "lower"; - - if (value == EnumStringRequiredEnum.Empty) - return ""; - - if (value == EnumStringRequiredEnum.ValuewithTab) - return "Value\twith tab"; - - if (value == EnumStringRequiredEnum.ValueWithQuote) - return "Value with \" quote"; - - if (value == EnumStringRequiredEnum.ValueWithEscapedQuote) - return "Value with escaped \" quote"; - - if (value == EnumStringRequiredEnum.Duplicatevalue) - return "Duplicate\nvalue"; - - if (value == EnumStringRequiredEnum.Duplicatevalue2) - return "Duplicate\r\nvalue"; - - throw new NotImplementedException($"Value could not be handled: '{value}'"); - } + [JsonIgnore] + public Option OuterEnumIntegerOption { get; private set; } // option a /// - /// Gets or Sets EnumStringRequired + /// Gets or Sets OuterEnumInteger /// - [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } + [JsonPropertyName("outerEnumInteger")] + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new Option(value); } } // a /// - /// Gets or Sets OuterEnumDefaultValue + /// Used to track the state of OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue OuterEnumDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a /// - /// Gets or Sets OuterEnumInteger + /// Gets or Sets OuterEnumIntegerDefaultValue /// - [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger OuterEnumInteger { get; set; } + [JsonPropertyName("outerEnumIntegerDefaultValue")] + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new Option(value); } } // a /// - /// Gets or Sets OuterEnumIntegerDefaultValue + /// Used to track the state of OuterEnum /// - [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue OuterEnumIntegerDefaultValue { get; set; } + [JsonIgnore] + public Option OuterEnumOption { get; private set; } // option a /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get; set; } + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new Option(value); } } // a /// /// Gets or Sets additional properties @@ -612,11 +658,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class EnumTest {\n"); + sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n"); sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); - sb.Append(" EnumStringRequired: ").Append(EnumStringRequired).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); @@ -659,15 +705,15 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - EnumTest.EnumIntegerEnum? enumInteger = default; - EnumTest.EnumIntegerOnlyEnum? enumIntegerOnly = default; - EnumTest.EnumNumberEnum? enumNumber = default; - EnumTest.EnumStringEnum? enumString = default; - EnumTest.EnumStringRequiredEnum? enumStringRequired = default; - OuterEnumDefaultValue? outerEnumDefaultValue = default; - OuterEnumInteger? outerEnumInteger = default; - OuterEnumIntegerDefaultValue? outerEnumIntegerDefaultValue = default; - OuterEnum? outerEnum = default; + Option enumStringRequired = default; + Option enumInteger = default; + Option enumIntegerOnly = default; + Option enumNumber = default; + Option enumString = default; + Option outerEnumDefaultValue = default; + Option outerEnumInteger = default; + Option outerEnumIntegerDefaultValue = default; + Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -684,53 +730,47 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { + case "enum_string_required": + string enumStringRequiredRawValue = utf8JsonReader.GetString(); + if (enumStringRequiredRawValue != null) + enumStringRequired = new Option(EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue)); + break; case "enum_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumInteger = (EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32(); + enumInteger = new Option((EnumTest.EnumIntegerEnum)utf8JsonReader.GetInt32()); break; case "enum_integer_only": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumIntegerOnly = (EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32(); + enumIntegerOnly = new Option((EnumTest.EnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); break; case "enum_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - enumNumber = (EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32(); + enumNumber = new Option((EnumTest.EnumNumberEnum)utf8JsonReader.GetInt32()); break; case "enum_string": string enumStringRawValue = utf8JsonReader.GetString(); - enumString = enumStringRawValue == null - ? null - : EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue); - break; - case "enum_string_required": - string enumStringRequiredRawValue = utf8JsonReader.GetString(); - enumStringRequired = enumStringRequiredRawValue == null - ? null - : EnumTest.EnumStringRequiredEnumFromStringOrDefault(enumStringRequiredRawValue); + if (enumStringRawValue != null) + enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumDefaultValue = outerEnumDefaultValueRawValue == null - ? null - : OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue); + if (outerEnumDefaultValueRawValue != null) + outerEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(outerEnumDefaultValueRawValue)); break; case "outerEnumInteger": string outerEnumIntegerRawValue = utf8JsonReader.GetString(); - outerEnumInteger = outerEnumIntegerRawValue == null - ? null - : OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue); + if (outerEnumIntegerRawValue != null) + outerEnumInteger = new Option(OuterEnumIntegerValueConverter.FromStringOrDefault(outerEnumIntegerRawValue)); break; case "outerEnumIntegerDefaultValue": string outerEnumIntegerDefaultValueRawValue = utf8JsonReader.GetString(); - outerEnumIntegerDefaultValue = outerEnumIntegerDefaultValueRawValue == null - ? null - : OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue); + if (outerEnumIntegerDefaultValueRawValue != null) + outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; case "outerEnum": string outerEnumRawValue = utf8JsonReader.GetString(); - outerEnum = outerEnumRawValue == null - ? null - : OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); break; default: break; @@ -738,31 +778,34 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (enumInteger == null) - throw new ArgumentNullException(nameof(enumInteger), "Property is required for class EnumTest."); + if (!enumStringRequired.IsSet) + throw new ArgumentException("Property is required for class EnumTest.", nameof(enumStringRequired)); - if (enumIntegerOnly == null) - throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is required for class EnumTest."); + if (enumStringRequired.IsSet && enumStringRequired.Value == null) + throw new ArgumentNullException(nameof(enumStringRequired), "Property is not nullable for class EnumTest."); - if (enumNumber == null) - throw new ArgumentNullException(nameof(enumNumber), "Property is required for class EnumTest."); + if (enumInteger.IsSet && enumInteger.Value == null) + throw new ArgumentNullException(nameof(enumInteger), "Property is not nullable for class EnumTest."); - if (enumString == null) - throw new ArgumentNullException(nameof(enumString), "Property is required for class EnumTest."); + if (enumIntegerOnly.IsSet && enumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(enumIntegerOnly), "Property is not nullable for class EnumTest."); - if (enumStringRequired == null) - throw new ArgumentNullException(nameof(enumStringRequired), "Property is required for class EnumTest."); + if (enumNumber.IsSet && enumNumber.Value == null) + throw new ArgumentNullException(nameof(enumNumber), "Property is not nullable for class EnumTest."); - if (outerEnumDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is required for class EnumTest."); + if (enumString.IsSet && enumString.Value == null) + throw new ArgumentNullException(nameof(enumString), "Property is not nullable for class EnumTest."); - if (outerEnumInteger == null) - throw new ArgumentNullException(nameof(outerEnumInteger), "Property is required for class EnumTest."); + if (outerEnumDefaultValue.IsSet && outerEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumDefaultValue), "Property is not nullable for class EnumTest."); - if (outerEnumIntegerDefaultValue == null) - throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is required for class EnumTest."); + if (outerEnumInteger.IsSet && outerEnumInteger.Value == null) + throw new ArgumentNullException(nameof(outerEnumInteger), "Property is not nullable for class EnumTest."); - return new EnumTest(enumInteger.Value, enumIntegerOnly.Value, enumNumber.Value, enumString.Value, enumStringRequired.Value, outerEnumDefaultValue.Value, outerEnumInteger.Value, outerEnumIntegerDefaultValue.Value, outerEnum); + if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) + throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); + + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a } /// @@ -789,44 +832,50 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumInteger)); - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnly)); - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumber)); - - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumString); - if (enumStringRawValue != null) - writer.WriteString("enum_string", enumStringRawValue); - else - writer.WriteNull("enum_string"); - - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue); + if (enumTest.EnumIntegerOption.IsSet) + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); // 6 - if (outerEnumDefaultValueRawValue != null) - writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); - else - writer.WriteNull("outerEnumDefaultValue"); + if (enumTest.EnumIntegerOnlyOption.IsSet) + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); // 6 - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger); - writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue); - writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + if (enumTest.EnumNumberOption.IsSet) + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); // 6 - if (enumTest.OuterEnum == null) - writer.WriteNull("outerEnum"); + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); // 7 + if (enumStringRawValue != null) + writer.WriteString("enum_string", enumStringRawValue); else + writer.WriteNull("enum_string"); + + if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + { + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); // 10 b + writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); + } + if (enumTest.OuterEnumIntegerOption.IsSet) // 10 { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnum.Value); - if (outerEnumRawValue != null) + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); // 10 b + writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); + } + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + { + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); // 10 b + writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); + } + if (enumTest.OuterEnumOption.IsSet) // 10 + if (enumTest.OuterEnumOption.Value != null) // 10 a + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); // 10 c writer.WriteString("outerEnum", outerEnumRawValue); + } else writer.WriteNull("outerEnum"); - } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 626748ff2097..7e719d26f712 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class EquilateralTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class EquilateralTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class EquilateralTriangle.", nameof(triangleType)); - return new EquilateralTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class EquilateralTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); + + return new EquilateralTriangle(shapeType.Value, triangleType.Value); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, EquilateralTriangle equilatera /// public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equilateralTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); + if (equilateralTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.ShapeType), "Property is required for class EquilateralTriangle."); + + if (equilateralTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); + + writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 905e5452f7c0..2f8220a98e63 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class File : IValidatableObject /// /// Test capitalization [JsonConstructor] - public File(string sourceURI) + public File(Option sourceURI = default) { - SourceURI = sourceURI; + SourceURIOption = sourceURI; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SourceURI + /// + [JsonIgnore] + public Option SourceURIOption { get; private set; } // option d + /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get; set; } + public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -101,7 +108,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string sourceURI = default; + Option sourceURI = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "sourceURI": - sourceURI = utf8JsonReader.GetString(); + sourceURI = new Option(utf8JsonReader.GetString()); break; default: break; @@ -127,10 +134,10 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (sourceURI == null) - throw new ArgumentNullException(nameof(sourceURI), "Property is required for class File."); + if (sourceURI.IsSet && sourceURI.Value == null) + throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); + return new File(sourceURI); // a } /// @@ -157,7 +164,11 @@ public override void Write(Utf8JsonWriter writer, File file, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("sourceURI", file.SourceURI); + if (file.SourceURIOption.IsSet && file.SourceURI == null) + throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); + + if (file.SourceURIOption.IsSet) + writer.WriteString("sourceURI", file.SourceURI); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 722ba3b949f0..7512805430de 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class FileSchemaTestClass : IValidatableObject /// file /// files [JsonConstructor] - public FileSchemaTestClass(File file, List files) + public FileSchemaTestClass(Option file = default, Option> files = default) { - File = file; - Files = files; + FileOption = file; + FilesOption = files; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of File + /// + [JsonIgnore] + public Option FileOption { get; private set; } // option d + /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get; set; } + public File File { get { return this. FileOption; } set { this.FileOption = new Option(value); } } // d + + /// + /// Used to track the state of Files + /// + [JsonIgnore] + public Option> FilesOption { get; private set; } // option d /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get; set; } + public List Files { get { return this. FilesOption; } set { this.FilesOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - File file = default; - List files = default; + Option file = default; + Option> files = default; while (utf8JsonReader.Read()) { @@ -129,11 +142,11 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "file": if (utf8JsonReader.TokenType != JsonTokenType.Null) - file = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + file = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "files": if (utf8JsonReader.TokenType != JsonTokenType.Null) - files = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + files = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -141,13 +154,13 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (file == null) - throw new ArgumentNullException(nameof(file), "Property is required for class FileSchemaTestClass."); + if (file.IsSet && file.Value == null) + throw new ArgumentNullException(nameof(file), "Property is not nullable for class FileSchemaTestClass."); - if (files == null) - throw new ArgumentNullException(nameof(files), "Property is required for class FileSchemaTestClass."); + if (files.IsSet && files.Value == null) + throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); + return new FileSchemaTestClass(file, files); // a } /// @@ -174,10 +187,18 @@ public override void Write(Utf8JsonWriter writer, FileSchemaTestClass fileSchema /// public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileSchemaTestClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("file"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - writer.WritePropertyName("files"); - JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + if (fileSchemaTestClass.FileOption.IsSet && fileSchemaTestClass.File == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.File), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) + throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); + + if (fileSchemaTestClass.FileOption.IsSet) // 14 + writer.WritePropertyName("file"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + if (fileSchemaTestClass.FilesOption.IsSet) // 14 + writer.WritePropertyName("files"); + JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index 9cfe3b508fe8..e99ebbb9798e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Foo : IValidatableObject /// /// bar (default to "bar") [JsonConstructor] - public Foo(string bar = @"bar") + public Foo(Option bar = default) { - Bar = bar; + BarOption = bar; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; private set; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; set; } + public string Bar { get { return this. BarOption; } set { this.BarOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; + Option bar = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class Foo."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); + return new Foo(bar); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, Foo foo, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", foo.Bar); + if (foo.BarOption.IsSet && foo.Bar == null) + throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); + + if (foo.BarOption.IsSet) + writer.WriteString("bar", foo.Bar); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index c8291e8eae5b..7bc572772cfa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class FooGetDefaultResponse : IValidatableObject /// /// varString [JsonConstructor] - public FooGetDefaultResponse(Foo varString) + public FooGetDefaultResponse(Option varString = default) { - VarString = varString; + VarStringOption = varString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d + /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get; set; } + public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Foo varString = default; + Option varString = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty { case "string": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varString = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varString = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty } } - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FooGetDefaultResponse."); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); + return new FooGetDefaultResponse(varString); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, FooGetDefaultResponse fooGetDe /// public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse fooGetDefaultResponse, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("string"); - JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) + throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); + + if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + writer.WritePropertyName("string"); + JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index 30a9b189932a..2275cef21cd6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,9 +32,11 @@ public partial class FormatTest : IValidatableObject /// /// Initializes a new instance of the class. /// - /// binary /// varByte /// date + /// number + /// password + /// binary /// dateTime /// varDecimal /// varDouble @@ -41,8 +44,6 @@ public partial class FormatTest : IValidatableObject /// int32 /// int64 /// integer - /// number - /// password /// None /// A string that is a 10 digit number. Can have leading zeros. /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. @@ -51,151 +52,241 @@ public partial class FormatTest : IValidatableObject /// unsignedLong /// uuid [JsonConstructor] - public FormatTest(System.IO.Stream binary, byte[] varByte, DateTime date, DateTime dateTime, decimal varDecimal, double varDouble, float varFloat, int int32, long int64, int integer, decimal number, string password, string patternWithBackslash, string patternWithDigits, string patternWithDigitsAndDelimiter, string varString, uint unsignedInteger, ulong unsignedLong, Guid uuid) + public FormatTest(byte[] varByte, DateTime date, decimal number, string password, Option binary = default, Option dateTime = default, Option varDecimal = default, Option varDouble = default, Option varFloat = default, Option int32 = default, Option int64 = default, Option integer = default, Option patternWithBackslash = default, Option patternWithDigits = default, Option patternWithDigitsAndDelimiter = default, Option varString = default, Option unsignedInteger = default, Option unsignedLong = default, Option uuid = default) { - Binary = binary; VarByte = varByte; Date = date; - DateTime = dateTime; - VarDecimal = varDecimal; - VarDouble = varDouble; - VarFloat = varFloat; - Int32 = int32; - Int64 = int64; - Integer = integer; Number = number; Password = password; - PatternWithBackslash = patternWithBackslash; - PatternWithDigits = patternWithDigits; - PatternWithDigitsAndDelimiter = patternWithDigitsAndDelimiter; - VarString = varString; - UnsignedInteger = unsignedInteger; - UnsignedLong = unsignedLong; - Uuid = uuid; + BinaryOption = binary; + DateTimeOption = dateTime; + VarDecimalOption = varDecimal; + VarDoubleOption = varDouble; + VarFloatOption = varFloat; + Int32Option = int32; + Int64Option = int64; + IntegerOption = integer; + PatternWithBackslashOption = patternWithBackslash; + PatternWithDigitsOption = patternWithDigits; + PatternWithDigitsAndDelimiterOption = patternWithDigitsAndDelimiter; + VarStringOption = varString; + UnsignedIntegerOption = unsignedInteger; + UnsignedLongOption = unsignedLong; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Binary - /// - [JsonPropertyName("binary")] - public System.IO.Stream Binary { get; set; } - /// /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } + public byte[] VarByte { get; set; } // d /// /// Gets or Sets Date /// - /// Sun Feb 02 00:00:00 UTC 2020 + /// Sat Feb 01 19:00:00 EST 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } + public DateTime Date { get; set; } // d + + /// + /// Gets or Sets Number + /// + [JsonPropertyName("number")] + public decimal Number { get; set; } // d + + /// + /// Gets or Sets Password + /// + [JsonPropertyName("password")] + public string Password { get; set; } // d + + /// + /// Used to track the state of Binary + /// + [JsonIgnore] + public Option BinaryOption { get; private set; } // option d + + /// + /// Gets or Sets Binary + /// + [JsonPropertyName("binary")] + public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new Option(value); } } // d + + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } // d + + /// + /// Used to track the state of VarDecimal + /// + [JsonIgnore] + public Option VarDecimalOption { get; private set; } // option d /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal VarDecimal { get; set; } + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new Option(value); } } // d + + /// + /// Used to track the state of VarDouble + /// + [JsonIgnore] + public Option VarDoubleOption { get; private set; } // option d /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double VarDouble { get; set; } + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new Option(value); } } // d + + /// + /// Used to track the state of VarFloat + /// + [JsonIgnore] + public Option VarFloatOption { get; private set; } // option d /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float VarFloat { get; set; } + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new Option(value); } } // d + + /// + /// Used to track the state of Int32 + /// + [JsonIgnore] + public Option Int32Option { get; private set; } // option d /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int Int32 { get; set; } + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new Option(value); } } // d + + /// + /// Used to track the state of Int64 + /// + [JsonIgnore] + public Option Int64Option { get; private set; } // option d /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long Int64 { get; set; } + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new Option(value); } } // d /// - /// Gets or Sets Integer + /// Used to track the state of Integer /// - [JsonPropertyName("integer")] - public int Integer { get; set; } + [JsonIgnore] + public Option IntegerOption { get; private set; } // option d /// - /// Gets or Sets Number + /// Gets or Sets Integer /// - [JsonPropertyName("number")] - public decimal Number { get; set; } + [JsonPropertyName("integer")] + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new Option(value); } } // d /// - /// Gets or Sets Password + /// Used to track the state of PatternWithBackslash /// - [JsonPropertyName("password")] - public string Password { get; set; } + [JsonIgnore] + public Option PatternWithBackslashOption { get; private set; } // option d /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get; set; } + public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new Option(value); } } // d + + /// + /// Used to track the state of PatternWithDigits + /// + [JsonIgnore] + public Option PatternWithDigitsOption { get; private set; } // option d /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get; set; } + public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new Option(value); } } // d + + /// + /// Used to track the state of PatternWithDigitsAndDelimiter + /// + [JsonIgnore] + public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get; set; } + public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new Option(value); } } // d + + /// + /// Used to track the state of VarString + /// + [JsonIgnore] + public Option VarStringOption { get; private set; } // option d /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get; set; } + public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } // d + + /// + /// Used to track the state of UnsignedInteger + /// + [JsonIgnore] + public Option UnsignedIntegerOption { get; private set; } // option d /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint UnsignedInteger { get; set; } + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new Option(value); } } // d + + /// + /// Used to track the state of UnsignedLong + /// + [JsonIgnore] + public Option UnsignedLongOption { get; private set; } // option d /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong UnsignedLong { get; set; } + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new Option(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -211,9 +302,11 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class FormatTest {\n"); - sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" VarByte: ").Append(VarByte).Append("\n"); sb.Append(" Date: ").Append(Date).Append("\n"); + sb.Append(" Number: ").Append(Number).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Binary: ").Append(Binary).Append("\n"); sb.Append(" DateTime: ").Append(DateTime).Append("\n"); sb.Append(" VarDecimal: ").Append(VarDecimal).Append("\n"); sb.Append(" VarDouble: ").Append(VarDouble).Append("\n"); @@ -221,8 +314,6 @@ public override string ToString() sb.Append(" Int32: ").Append(Int32).Append("\n"); sb.Append(" Int64: ").Append(Int64).Append("\n"); sb.Append(" Integer: ").Append(Integer).Append("\n"); - sb.Append(" Number: ").Append(Number).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" PatternWithBackslash: ").Append(PatternWithBackslash).Append("\n"); sb.Append(" PatternWithDigits: ").Append(PatternWithDigits).Append("\n"); sb.Append(" PatternWithDigitsAndDelimiter: ").Append(PatternWithDigitsAndDelimiter).Append("\n"); @@ -242,122 +333,126 @@ public override string ToString() /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { + // Number (decimal) maximum + if (this.Number > (decimal)543.2) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); + } + + // Number (decimal) minimum + if (this.Number < (decimal)32.1) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); + } + + // Password (string) maxLength + if (this.Password != null && this.Password.Length > 64) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); + } + + // Password (string) minLength + if (this.Password != null && this.Password.Length < 10) + { + yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); + } + // VarDouble (double) maximum - if (this.VarDouble > (double)123.4) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value > (double)123.4) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value less than or equal to 123.4.", new [] { "VarDouble" }); } // VarDouble (double) minimum - if (this.VarDouble < (double)67.8) + if (this.VarDoubleOption.IsSet && this.VarDoubleOption.Value < (double)67.8) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarDouble, must be a value greater than or equal to 67.8.", new [] { "VarDouble" }); } // VarFloat (float) maximum - if (this.VarFloat > (float)987.6) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value > (float)987.6) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value less than or equal to 987.6.", new [] { "VarFloat" }); } // VarFloat (float) minimum - if (this.VarFloat < (float)54.3) + if (this.VarFloatOption.IsSet && this.VarFloatOption.Value < (float)54.3) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarFloat, must be a value greater than or equal to 54.3.", new [] { "VarFloat" }); } // Int32 (int) maximum - if (this.Int32 > (int)200) + if (this.Int32Option.IsSet && this.Int32Option.Value > (int)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value less than or equal to 200.", new [] { "Int32" }); } // Int32 (int) minimum - if (this.Int32 < (int)20) + if (this.Int32Option.IsSet && this.Int32Option.Value < (int)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Int32, must be a value greater than or equal to 20.", new [] { "Int32" }); } // Integer (int) maximum - if (this.Integer > (int)100) + if (this.IntegerOption.IsSet && this.IntegerOption.Value > (int)100) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value less than or equal to 100.", new [] { "Integer" }); } // Integer (int) minimum - if (this.Integer < (int)10) + if (this.IntegerOption.IsSet && this.IntegerOption.Value < (int)10) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Integer, must be a value greater than or equal to 10.", new [] { "Integer" }); } - // Number (decimal) maximum - if (this.Number > (decimal)543.2) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value less than or equal to 543.2.", new [] { "Number" }); - } - - // Number (decimal) minimum - if (this.Number < (decimal)32.1) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Number, must be a value greater than or equal to 32.1.", new [] { "Number" }); - } - - // Password (string) maxLength - if (this.Password != null && this.Password.Length > 64) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be less than 64.", new [] { "Password" }); - } - - // Password (string) minLength - if (this.Password != null && this.Password.Length < 10) - { - yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Password, length must be greater than 10.", new [] { "Password" }); - } - - if (this.PatternWithBackslash != null) { + if (this.PatternWithBackslashOption.Value != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + + if (this.PatternWithBackslashOption.Value != null &&!regexPatternWithBackslash.Match(this.PatternWithBackslashOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } } - if (this.PatternWithDigits != null) { + if (this.PatternWithDigitsOption.Value != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + + if (this.PatternWithDigitsOption.Value != null &&!regexPatternWithDigits.Match(this.PatternWithDigitsOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } } - if (this.PatternWithDigitsAndDelimiter != null) { + if (this.PatternWithDigitsAndDelimiterOption.Value != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + + if (this.PatternWithDigitsAndDelimiterOption.Value != null &&!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiterOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } } - if (this.VarString != null) { + if (this.VarStringOption.Value != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + + if (this.VarStringOption.Value != null &&!regexVarString.Match(this.VarStringOption.Value).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } } // UnsignedInteger (uint) maximum - if (this.UnsignedInteger > (uint)200) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value > (uint)200) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value less than or equal to 200.", new [] { "UnsignedInteger" }); } // UnsignedInteger (uint) minimum - if (this.UnsignedInteger < (uint)20) + if (this.UnsignedIntegerOption.IsSet && this.UnsignedIntegerOption.Value < (uint)20) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UnsignedInteger, must be a value greater than or equal to 20.", new [] { "UnsignedInteger" }); } @@ -398,25 +493,25 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - System.IO.Stream binary = default; - byte[] varByte = default; - DateTime? date = default; - DateTime? dateTime = default; - decimal? varDecimal = default; - double? varDouble = default; - float? varFloat = default; - int? int32 = default; - long? int64 = default; - int? integer = default; - decimal? number = default; - string password = default; - string patternWithBackslash = default; - string patternWithDigits = default; - string patternWithDigitsAndDelimiter = default; - string varString = default; - uint? unsignedInteger = default; - ulong? unsignedLong = default; - Guid? uuid = default; + Option varByte = default; + Option date = default; + Option number = default; + Option password = default; + Option binary = default; + Option dateTime = default; + Option varDecimal = default; + Option varDouble = default; + Option varFloat = default; + Option int32 = default; + Option int64 = default; + Option integer = default; + Option patternWithBackslash = default; + Option patternWithDigits = default; + Option patternWithDigitsAndDelimiter = default; + Option varString = default; + Option unsignedInteger = default; + Option unsignedLong = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -433,76 +528,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo switch (localVarJsonPropertyName) { - case "binary": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - binary = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); - break; case "byte": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varByte = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varByte = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "date": if (utf8JsonReader.TokenType != JsonTokenType.Null) - date = 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()); + break; + case "password": + password = new Option(utf8JsonReader.GetString()); + break; + case "binary": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + binary = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "decimal": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDecimal = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + varDecimal = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "double": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varDouble = utf8JsonReader.GetDouble(); + varDouble = new Option(utf8JsonReader.GetDouble()); break; case "float": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varFloat = (float)utf8JsonReader.GetDouble(); + varFloat = new Option((float)utf8JsonReader.GetDouble()); break; case "int32": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int32 = utf8JsonReader.GetInt32(); + int32 = new Option(utf8JsonReader.GetInt32()); break; case "int64": if (utf8JsonReader.TokenType != JsonTokenType.Null) - int64 = utf8JsonReader.GetInt64(); + int64 = new Option(utf8JsonReader.GetInt64()); break; case "integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integer = utf8JsonReader.GetInt32(); - break; - case "number": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - number = utf8JsonReader.GetDecimal(); - break; - case "password": - password = utf8JsonReader.GetString(); + integer = new Option(utf8JsonReader.GetInt32()); break; case "pattern_with_backslash": - patternWithBackslash = utf8JsonReader.GetString(); + patternWithBackslash = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits": - patternWithDigits = utf8JsonReader.GetString(); + patternWithDigits = new Option(utf8JsonReader.GetString()); break; case "pattern_with_digits_and_delimiter": - patternWithDigitsAndDelimiter = utf8JsonReader.GetString(); + patternWithDigitsAndDelimiter = new Option(utf8JsonReader.GetString()); break; case "string": - varString = utf8JsonReader.GetString(); + varString = new Option(utf8JsonReader.GetString()); break; case "unsigned_integer": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedInteger = utf8JsonReader.GetUInt32(); + unsignedInteger = new Option(utf8JsonReader.GetUInt32()); break; case "unsigned_long": if (utf8JsonReader.TokenType != JsonTokenType.Null) - unsignedLong = utf8JsonReader.GetUInt64(); + unsignedLong = new Option(utf8JsonReader.GetUInt64()); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -510,64 +605,76 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (binary == null) - throw new ArgumentNullException(nameof(binary), "Property is required for class FormatTest."); + if (!varByte.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(varByte)); - if (varByte == null) - throw new ArgumentNullException(nameof(varByte), "Property is required for class FormatTest."); + if (!date.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(date)); - if (date == null) - throw new ArgumentNullException(nameof(date), "Property is required for class FormatTest."); + if (!number.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(number)); - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class FormatTest."); + if (!password.IsSet) + throw new ArgumentException("Property is required for class FormatTest.", nameof(password)); - if (varDecimal == null) - throw new ArgumentNullException(nameof(varDecimal), "Property is required for class FormatTest."); + if (varByte.IsSet && varByte.Value == null) + throw new ArgumentNullException(nameof(varByte), "Property is not nullable for class FormatTest."); - if (varDouble == null) - throw new ArgumentNullException(nameof(varDouble), "Property is required for class FormatTest."); + if (date.IsSet && date.Value == null) + throw new ArgumentNullException(nameof(date), "Property is not nullable for class FormatTest."); - if (varFloat == null) - throw new ArgumentNullException(nameof(varFloat), "Property is required for class FormatTest."); + if (number.IsSet && number.Value == null) + throw new ArgumentNullException(nameof(number), "Property is not nullable for class FormatTest."); - if (int32 == null) - throw new ArgumentNullException(nameof(int32), "Property is required for class FormatTest."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class FormatTest."); - if (int64 == null) - throw new ArgumentNullException(nameof(int64), "Property is required for class FormatTest."); + if (binary.IsSet && binary.Value == null) + throw new ArgumentNullException(nameof(binary), "Property is not nullable for class FormatTest."); - if (integer == null) - throw new ArgumentNullException(nameof(integer), "Property is required for class FormatTest."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class FormatTest."); - if (number == null) - throw new ArgumentNullException(nameof(number), "Property is required for class FormatTest."); + if (varDecimal.IsSet && varDecimal.Value == null) + throw new ArgumentNullException(nameof(varDecimal), "Property is not nullable for class FormatTest."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class FormatTest."); + if (varDouble.IsSet && varDouble.Value == null) + throw new ArgumentNullException(nameof(varDouble), "Property is not nullable for class FormatTest."); - if (patternWithBackslash == null) - throw new ArgumentNullException(nameof(patternWithBackslash), "Property is required for class FormatTest."); + if (varFloat.IsSet && varFloat.Value == null) + throw new ArgumentNullException(nameof(varFloat), "Property is not nullable for class FormatTest."); - if (patternWithDigits == null) - throw new ArgumentNullException(nameof(patternWithDigits), "Property is required for class FormatTest."); + if (int32.IsSet && int32.Value == null) + throw new ArgumentNullException(nameof(int32), "Property is not nullable for class FormatTest."); - if (patternWithDigitsAndDelimiter == null) - throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + if (int64.IsSet && int64.Value == null) + throw new ArgumentNullException(nameof(int64), "Property is not nullable for class FormatTest."); - if (varString == null) - throw new ArgumentNullException(nameof(varString), "Property is required for class FormatTest."); + if (integer.IsSet && integer.Value == null) + throw new ArgumentNullException(nameof(integer), "Property is not nullable for class FormatTest."); - if (unsignedInteger == null) - throw new ArgumentNullException(nameof(unsignedInteger), "Property is required for class FormatTest."); + if (patternWithBackslash.IsSet && patternWithBackslash.Value == null) + throw new ArgumentNullException(nameof(patternWithBackslash), "Property is not nullable for class FormatTest."); - if (unsignedLong == null) - throw new ArgumentNullException(nameof(unsignedLong), "Property is required for class FormatTest."); + if (patternWithDigits.IsSet && patternWithDigits.Value == null) + throw new ArgumentNullException(nameof(patternWithDigits), "Property is not nullable for class FormatTest."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class FormatTest."); + if (patternWithDigitsAndDelimiter.IsSet && patternWithDigitsAndDelimiter.Value == null) + throw new ArgumentNullException(nameof(patternWithDigitsAndDelimiter), "Property is not nullable for class FormatTest."); - return new FormatTest(binary, varByte, date.Value, dateTime.Value, varDecimal.Value, varDouble.Value, varFloat.Value, int32.Value, int64.Value, integer.Value, number.Value, password, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger.Value, unsignedLong.Value, uuid.Value); + if (varString.IsSet && varString.Value == null) + throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FormatTest."); + + if (unsignedInteger.IsSet && unsignedInteger.Value == null) + throw new ArgumentNullException(nameof(unsignedInteger), "Property is not nullable for class FormatTest."); + + if (unsignedLong.IsSet && unsignedLong.Value == null) + throw new ArgumentNullException(nameof(unsignedLong), "Property is not nullable for class FormatTest."); + + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); + + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a } /// @@ -594,28 +701,79 @@ public override void Write(Utf8JsonWriter writer, FormatTest formatTest, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("binary"); - JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.VarByte == null) + throw new ArgumentNullException(nameof(formatTest.VarByte), "Property is required for class FormatTest."); + + if (formatTest.Password == null) + throw new ArgumentNullException(nameof(formatTest.Password), "Property is required for class FormatTest."); + + if (formatTest.BinaryOption.IsSet && formatTest.Binary == null) + throw new ArgumentNullException(nameof(formatTest.Binary), "Property is required for class FormatTest."); + + if (formatTest.PatternWithBackslashOption.IsSet && formatTest.PatternWithBackslash == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithBackslash), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsOption.IsSet && formatTest.PatternWithDigits == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigits), "Property is required for class FormatTest."); + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet && formatTest.PatternWithDigitsAndDelimiter == null) + throw new ArgumentNullException(nameof(formatTest.PatternWithDigitsAndDelimiter), "Property is required for class FormatTest."); + + if (formatTest.VarStringOption.IsSet && formatTest.VarString == null) + throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); + writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteString("dateTime", formatTest.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("decimal"); - JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); - writer.WriteNumber("double", formatTest.VarDouble); - writer.WriteNumber("float", formatTest.VarFloat); - writer.WriteNumber("int32", formatTest.Int32); - writer.WriteNumber("int64", formatTest.Int64); - writer.WriteNumber("integer", formatTest.Integer); - writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); - writer.WriteString("string", formatTest.VarString); - writer.WriteNumber("unsigned_integer", formatTest.UnsignedInteger); - writer.WriteNumber("unsigned_long", formatTest.UnsignedLong); - writer.WriteString("uuid", formatTest.Uuid); + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + + writer.WriteNumber("number", formatTest.Number); // 3 + + writer.WriteString("password", formatTest.Password); // 1 + + if (formatTest.BinaryOption.IsSet) // 14 + writer.WritePropertyName("binary"); + JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + if (formatTest.DateTimeOption.IsSet) + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + + if (formatTest.VarDecimalOption.IsSet) // 14 + writer.WritePropertyName("decimal"); + JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + if (formatTest.VarDoubleOption.IsSet) + writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); // 3 + + if (formatTest.VarFloatOption.IsSet) + writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); // 3 + + if (formatTest.Int32Option.IsSet) + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); // 3 + + if (formatTest.Int64Option.IsSet) + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); // 3 + + if (formatTest.IntegerOption.IsSet) + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); // 3 + + if (formatTest.PatternWithBackslashOption.IsSet) + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + + if (formatTest.PatternWithDigitsOption.IsSet) + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + + if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + + if (formatTest.VarStringOption.IsSet) + writer.WriteString("string", formatTest.VarString); // 1 + + if (formatTest.UnsignedIntegerOption.IsSet) + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); // 3 + + if (formatTest.UnsignedLongOption.IsSet) + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); // 3 + + if (formatTest.UuidOption.IsSet) + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index 2e05ffb958a4..603a7d932b2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,10 +34,10 @@ public partial class Fruit : IValidatableObject /// /// /// color - public Fruit(Apple apple, string color) + public Fruit(Apple apple, Option color = default) { Apple = apple; - Color = color; + ColorOption = color; OnCreated(); } @@ -45,10 +46,10 @@ public Fruit(Apple apple, string color) /// /// /// color - public Fruit(Banana banana, string color) + public Fruit(Banana banana, Option color = default) { Banana = banana; - Color = color; + ColorOption = color; OnCreated(); } @@ -64,11 +65,17 @@ public Fruit(Banana banana, string color) /// public Banana Banana { get; set; } + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d + /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -116,7 +123,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -156,7 +163,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -164,14 +171,14 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class Fruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); + return new Fruit(apple, color); // b if (banana != null) - return new Fruit(banana, color); + return new Fruit(banana, color); // b throw new JsonException(); } @@ -200,7 +207,11 @@ public override void Write(Utf8JsonWriter writer, Fruit fruit, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", fruit.Color); + if (fruit.ColorOption.IsSet && fruit.Color == null) + throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); + + if (fruit.ColorOption.IsSet) + writer.WriteString("color", fruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs index aa26d3600c05..7fd5e012fc5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -149,10 +150,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); + return new FruitReq(appleReq); // b if (bananaReq != null) - return new FruitReq(bananaReq); + return new FruitReq(bananaReq); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index 3c2d1ecefc94..d31a9f7bd6ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,31 +35,49 @@ public partial class GmFruit : IValidatableObject /// /// /// color - public GmFruit(Apple apple, Banana banana, string color) + public GmFruit(Option apple, Option banana, Option color = default) { - Apple = apple; - Banana = banana; - Color = color; + AppleOption = apple; + BananaOption = banana; + ColorOption = color; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Apple + /// + [JsonIgnore] + public Option AppleOption { get; private set; } // option b + /// /// Gets or Sets Apple /// - public Apple Apple { get; set; } + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new Option(value); } } // b + + /// + /// Used to track the state of Banana + /// + [JsonIgnore] + public Option BananaOption { get; private set; } // option b /// /// Gets or Sets Banana /// - public Banana Banana { get; set; } + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new Option(value); } } // b + + /// + /// Used to track the state of Color + /// + [JsonIgnore] + public Option ColorOption { get; private set; } // option d /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get; set; } + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d /// /// Returns the string presentation of the object @@ -106,7 +125,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string color = default; + Option color = default; Apple apple = default; Banana banana = default; @@ -146,7 +165,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve switch (localVarJsonPropertyName) { case "color": - color = utf8JsonReader.GetString(); + color = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,10 +173,17 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (color == null) - throw new ArgumentNullException(nameof(color), "Property is required for class GmFruit."); + if (color.IsSet && color.Value == null) + throw new ArgumentNullException(nameof(color), "Property is not nullable for class GmFruit."); - return new GmFruit(apple, banana, color); + Option appleParsedValue = apple == null + ? default + : new Option(apple); + Option bananaParsedValue = banana == null + ? default + : new Option(banana); + + return new GmFruit(appleParsedValue, bananaParsedValue, color); // a } /// @@ -171,16 +197,16 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize { writer.WriteStartObject(); - if (gmFruit.Apple != null) + if (gmFruit.AppleOption.IsSet && gmFruit.AppleOption.Value != null) { - AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Apple.GetType())); - AppleJsonConverter.WriteProperties(ref writer, gmFruit.Apple, jsonSerializerOptions); + AppleJsonConverter AppleJsonConverter = (AppleJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.AppleOption.Value.GetType())); + AppleJsonConverter.WriteProperties(ref writer, gmFruit.AppleOption.Value, jsonSerializerOptions); } - if (gmFruit.Banana != null) + if (gmFruit.BananaOption.IsSet && gmFruit.BananaOption.Value != null) { - BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.Banana.GetType())); - BananaJsonConverter.WriteProperties(ref writer, gmFruit.Banana, jsonSerializerOptions); + BananaJsonConverter BananaJsonConverter = (BananaJsonConverter) jsonSerializerOptions.Converters.First(c => c.CanConvert(gmFruit.BananaOption.Value.GetType())); + BananaJsonConverter.WriteProperties(ref writer, gmFruit.BananaOption.Value, jsonSerializerOptions); } WriteProperties(ref writer, gmFruit, jsonSerializerOptions); @@ -196,7 +222,11 @@ public override void Write(Utf8JsonWriter writer, GmFruit gmFruit, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("color", gmFruit.Color); + if (gmFruit.ColorOption.IsSet && gmFruit.Color == null) + throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); + + if (gmFruit.ColorOption.IsSet) + writer.WriteString("color", gmFruit.Color); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 7ae4662ed8d4..104b1e543cd8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } + public string PetType { get; set; } // d /// /// Gets or Sets additional properties @@ -110,7 +111,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -128,7 +129,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -136,10 +137,13 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class GrandparentAnimal."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class GrandparentAnimal.", nameof(petType)); - return new GrandparentAnimal(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); + + return new GrandparentAnimal(petType.Value); // a } /// @@ -166,7 +170,10 @@ public override void Write(Utf8JsonWriter writer, GrandparentAnimal grandparentA /// public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandparentAnimal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", grandparentAnimal.PetType); + if (grandparentAnimal.PetType == null) + throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); + + writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 31360d73f754..ba871e18b903 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class HasOnlyReadOnly : IEquatable, IValidatable /// bar /// foo [JsonConstructor] - internal HasOnlyReadOnly(string bar, string foo) + internal HasOnlyReadOnly(Option bar = default, Option foo = default) { - Bar = bar; - Foo = foo; + BarOption = bar; + FooOption = foo; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Foo + /// + [JsonIgnore] + public Option FooOption { get; } // option d /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get; } + public string Foo { get { return this. FooOption; } } // d /// /// Gets or Sets additional properties @@ -105,8 +118,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); - hashCode = (hashCode * 59) + Foo.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + + if (Foo != null) + hashCode = (hashCode * 59) + Foo.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -146,8 +163,8 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string foo = default; + Option bar = default; + Option foo = default; while (utf8JsonReader.Read()) { @@ -165,10 +182,10 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "foo": - foo = utf8JsonReader.GetString(); + foo = new Option(utf8JsonReader.GetString()); break; default: break; @@ -176,13 +193,13 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class HasOnlyReadOnly."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class HasOnlyReadOnly."); - if (foo == null) - throw new ArgumentNullException(nameof(foo), "Property is required for class HasOnlyReadOnly."); + if (foo.IsSet && foo.Value == null) + throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); + return new HasOnlyReadOnly(bar, foo); // a } /// @@ -209,8 +226,17 @@ public override void Write(Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnl /// public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyReadOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", hasOnlyReadOnly.Bar); - writer.WriteString("foo", hasOnlyReadOnly.Foo); + if (hasOnlyReadOnly.BarOption.IsSet && hasOnlyReadOnly.Bar == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Bar), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.FooOption.IsSet && hasOnlyReadOnly.Foo == null) + throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); + + if (hasOnlyReadOnly.BarOption.IsSet) + writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + + if (hasOnlyReadOnly.FooOption.IsSet) + writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 8355d97fa097..44558f1b7589 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class HealthCheckResult : IValidatableObject /// /// nullableMessage [JsonConstructor] - public HealthCheckResult(string nullableMessage = default) + public HealthCheckResult(Option nullableMessage = default) { - NullableMessage = nullableMessage; + NullableMessageOption = nullableMessage; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of NullableMessage + /// + [JsonIgnore] + public Option NullableMessageOption { get; private set; } // option d + /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get; set; } + public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string nullableMessage = default; + Option nullableMessage = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "NullableMessage": - nullableMessage = utf8JsonReader.GetString(); + nullableMessage = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,7 +133,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); + return new HealthCheckResult(nullableMessage); // a } /// @@ -153,7 +160,11 @@ public override void Write(Utf8JsonWriter writer, HealthCheckResult healthCheckR /// public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthCheckResult, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); + if (healthCheckResult.NullableMessageOption.IsSet) + if (healthCheckResult.NullableMessageOption.Value != null) + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + else + writer.WriteNull("NullableMessage"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 0355613042f2..f28b3dceafe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Returns the string presentation of the object @@ -102,8 +103,8 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -121,10 +122,10 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -132,13 +133,19 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class IsoscelesTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class IsoscelesTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class IsoscelesTriangle.", nameof(triangleType)); - return new IsoscelesTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class IsoscelesTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); + + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); // a } /// @@ -165,8 +172,15 @@ public override void Write(Utf8JsonWriter writer, IsoscelesTriangle isoscelesTri /// public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscelesTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); + if (isoscelesTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.ShapeType), "Property is required for class IsoscelesTriangle."); + + if (isoscelesTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); + + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index 42b0c9cb2cf1..0c6e2036c832 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class List : IValidatableObject /// /// var123List [JsonConstructor] - public List(string var123List) + public List(Option var123List = default) { - Var123List = var123List; + Var123ListOption = var123List; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Var123List + /// + [JsonIgnore] + public Option Var123ListOption { get; private set; } // option d + /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get; set; } + public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string var123List = default; + Option var123List = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "123-list": - var123List = utf8JsonReader.GetString(); + var123List = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (var123List == null) - throw new ArgumentNullException(nameof(var123List), "Property is required for class List."); + if (var123List.IsSet && var123List.Value == null) + throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); + return new List(var123List); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, List list, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("123-list", list.Var123List); + if (list.Var123ListOption.IsSet && list.Var123List == null) + throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); + + if (list.Var123ListOption.IsSet) + writer.WriteString("123-list", list.Var123List); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0ad8832af885..776eacbd52bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class LiteralStringClass : IValidatableObject /// escapedLiteralString (default to "C:\\Users\\username") /// unescapedLiteralString (default to "C:\Users\username") [JsonConstructor] - public LiteralStringClass(string escapedLiteralString = @"C:\\Users\\username", string unescapedLiteralString = @"C:\Users\username") + public LiteralStringClass(Option escapedLiteralString = default, Option unescapedLiteralString = default) { - EscapedLiteralString = escapedLiteralString; - UnescapedLiteralString = unescapedLiteralString; + EscapedLiteralStringOption = escapedLiteralString; + UnescapedLiteralStringOption = unescapedLiteralString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of EscapedLiteralString + /// + [JsonIgnore] + public Option EscapedLiteralStringOption { get; private set; } // option d + /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get; set; } + public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new Option(value); } } // d + + /// + /// Used to track the state of UnescapedLiteralString + /// + [JsonIgnore] + public Option UnescapedLiteralStringOption { get; private set; } // option d /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get; set; } + public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string escapedLiteralString = default; - string unescapedLiteralString = default; + Option escapedLiteralString = default; + Option unescapedLiteralString = default; while (utf8JsonReader.Read()) { @@ -128,10 +141,10 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "escapedLiteralString": - escapedLiteralString = utf8JsonReader.GetString(); + escapedLiteralString = new Option(utf8JsonReader.GetString()); break; case "unescapedLiteralString": - unescapedLiteralString = utf8JsonReader.GetString(); + unescapedLiteralString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +152,13 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (escapedLiteralString == null) - throw new ArgumentNullException(nameof(escapedLiteralString), "Property is required for class LiteralStringClass."); + if (escapedLiteralString.IsSet && escapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(escapedLiteralString), "Property is not nullable for class LiteralStringClass."); - if (unescapedLiteralString == null) - throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is required for class LiteralStringClass."); + if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) + throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a } /// @@ -172,8 +185,17 @@ public override void Write(Utf8JsonWriter writer, LiteralStringClass literalStri /// public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass literalStringClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); + if (literalStringClass.EscapedLiteralStringOption.IsSet && literalStringClass.EscapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.EscapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.UnescapedLiteralStringOption.IsSet && literalStringClass.UnescapedLiteralString == null) + throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); + + if (literalStringClass.EscapedLiteralStringOption.IsSet) + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + + if (literalStringClass.UnescapedLiteralStringOption.IsSet) + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs index 92011ad0e1d9..14518765c768 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -85,7 +86,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -150,7 +151,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; Pig pig = null; Whale whale = null; @@ -207,7 +208,7 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,20 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Mammal."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Mammal.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className); + return new Mammal(pig, className.Value); // c if (whale != null) - return new Mammal(whale, className); + return new Mammal(whale, className.Value); // c if (zebra != null) - return new Mammal(zebra, className); + return new Mammal(zebra, className.Value); // c throw new JsonException(); } @@ -269,7 +273,10 @@ public override void Write(Utf8JsonWriter writer, Mammal mammal, JsonSerializerO /// public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", mammal.ClassName); + if (mammal.ClassName == null) + throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); + + writer.WriteString("className", mammal.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index a4fdf221e931..ec36bb84e367 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,12 +37,12 @@ public partial class MapTest : IValidatableObject /// mapMapOfString /// mapOfEnumString [JsonConstructor] - public MapTest(Dictionary directMap, Dictionary indirectMap, Dictionary> mapMapOfString, Dictionary mapOfEnumString) + public MapTest(Option> directMap = default, Option> indirectMap = default, Option>> mapMapOfString = default, Option> mapOfEnumString = default) { - DirectMap = directMap; - IndirectMap = indirectMap; - MapMapOfString = mapMapOfString; - MapOfEnumString = mapOfEnumString; + DirectMapOption = directMap; + IndirectMapOption = indirectMap; + MapMapOfStringOption = mapMapOfString; + MapOfEnumStringOption = mapOfEnumString; OnCreated(); } @@ -104,7 +105,6 @@ public static InnerEnum InnerEnumFromString(string value) /// public static string InnerEnumToJsonValue(InnerEnum value) { - if (value == InnerEnum.UPPER) return "UPPER"; @@ -114,29 +114,53 @@ public static string InnerEnumToJsonValue(InnerEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of DirectMap + /// + [JsonIgnore] + public Option> DirectMapOption { get; private set; } // option d + /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get; set; } + public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new Option>(value); } } // d + + /// + /// Used to track the state of IndirectMap + /// + [JsonIgnore] + public Option> IndirectMapOption { get; private set; } // option d /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get; set; } + public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new Option>(value); } } // d + + /// + /// Used to track the state of MapMapOfString + /// + [JsonIgnore] + public Option>> MapMapOfStringOption { get; private set; } // option d /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get; set; } + public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new Option>>(value); } } // d + + /// + /// Used to track the state of MapOfEnumString + /// + [JsonIgnore] + public Option> MapOfEnumStringOption { get; private set; } // option d /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get; set; } + public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -194,10 +218,10 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Dictionary directMap = default; - Dictionary indirectMap = default; - Dictionary> mapMapOfString = default; - Dictionary mapOfEnumString = default; + Option> directMap = default; + Option> indirectMap = default; + Option>> mapMapOfString = default; + Option> mapOfEnumString = default; while (utf8JsonReader.Read()) { @@ -216,19 +240,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve { case "direct_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - directMap = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + directMap = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "indirect_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - indirectMap = 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 = 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 = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + mapOfEnumString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -236,19 +260,19 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve } } - if (directMap == null) - throw new ArgumentNullException(nameof(directMap), "Property is required for class MapTest."); + if (directMap.IsSet && directMap.Value == null) + throw new ArgumentNullException(nameof(directMap), "Property is not nullable for class MapTest."); - if (indirectMap == null) - throw new ArgumentNullException(nameof(indirectMap), "Property is required for class MapTest."); + if (indirectMap.IsSet && indirectMap.Value == null) + throw new ArgumentNullException(nameof(indirectMap), "Property is not nullable for class MapTest."); - if (mapMapOfString == null) - throw new ArgumentNullException(nameof(mapMapOfString), "Property is required for class MapTest."); + if (mapMapOfString.IsSet && mapMapOfString.Value == null) + throw new ArgumentNullException(nameof(mapMapOfString), "Property is not nullable for class MapTest."); - if (mapOfEnumString == null) - throw new ArgumentNullException(nameof(mapOfEnumString), "Property is required for class MapTest."); + if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) + throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a } /// @@ -275,14 +299,30 @@ public override void Write(Utf8JsonWriter writer, MapTest mapTest, JsonSerialize /// public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("direct_map"); - JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - writer.WritePropertyName("indirect_map"); - JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - writer.WritePropertyName("map_map_of_string"); - JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - writer.WritePropertyName("map_of_enum_string"); - JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + if (mapTest.DirectMapOption.IsSet && mapTest.DirectMap == null) + throw new ArgumentNullException(nameof(mapTest.DirectMap), "Property is required for class MapTest."); + + if (mapTest.IndirectMapOption.IsSet && mapTest.IndirectMap == null) + throw new ArgumentNullException(nameof(mapTest.IndirectMap), "Property is required for class MapTest."); + + if (mapTest.MapMapOfStringOption.IsSet && mapTest.MapMapOfString == null) + throw new ArgumentNullException(nameof(mapTest.MapMapOfString), "Property is required for class MapTest."); + + if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) + throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); + + if (mapTest.DirectMapOption.IsSet) // 14 + writer.WritePropertyName("direct_map"); + JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + if (mapTest.IndirectMapOption.IsSet) // 14 + writer.WritePropertyName("indirect_map"); + JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + if (mapTest.MapMapOfStringOption.IsSet) // 14 + writer.WritePropertyName("map_map_of_string"); + JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + if (mapTest.MapOfEnumStringOption.IsSet) // 14 + writer.WritePropertyName("map_of_enum_string"); + JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 0ed70f02c2db..3848e1274944 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,40 +37,64 @@ public partial class MixedPropertiesAndAdditionalPropertiesClass : IValidatableO /// uuid /// uuidWithPattern [JsonConstructor] - public MixedPropertiesAndAdditionalPropertiesClass(DateTime dateTime, Dictionary map, Guid uuid, Guid uuidWithPattern) + public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = default, Option> map = default, Option uuid = default, Option uuidWithPattern = default) { - DateTime = dateTime; - Map = map; - Uuid = uuid; - UuidWithPattern = uuidWithPattern; + DateTimeOption = dateTime; + MapOption = map; + UuidOption = uuid; + UuidWithPatternOption = uuidWithPattern; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of DateTime + /// + [JsonIgnore] + public Option DateTimeOption { get; private set; } // option d + /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime DateTime { get; set; } + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } // d + + /// + /// Used to track the state of Map + /// + [JsonIgnore] + public Option> MapOption { get; private set; } // option d /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get; set; } + public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new Option>(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d + + /// + /// Used to track the state of UuidWithPattern + /// + [JsonIgnore] + public Option UuidWithPatternOption { get; private set; } // option d /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid UuidWithPattern { get; set; } + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -103,7 +128,8 @@ public override string ToString() { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -138,10 +164,10 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea JsonTokenType startingTokenType = utf8JsonReader.TokenType; - DateTime? dateTime = default; - Dictionary map = default; - Guid? uuid = default; - Guid? uuidWithPattern = default; + Option dateTime = default; + Option> map = default; + Option uuid = default; + Option uuidWithPattern = default; while (utf8JsonReader.Read()) { @@ -160,19 +186,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea { case "dateTime": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateTime = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateTime = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "map": if (utf8JsonReader.TokenType != JsonTokenType.Null) - map = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + map = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; case "uuid_with_pattern": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuidWithPattern = utf8JsonReader.GetGuid(); + uuidWithPattern = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -180,19 +206,19 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea } } - if (dateTime == null) - throw new ArgumentNullException(nameof(dateTime), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (dateTime.IsSet && dateTime.Value == null) + throw new ArgumentNullException(nameof(dateTime), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (map == null) - throw new ArgumentNullException(nameof(map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (map.IsSet && map.Value == null) + throw new ArgumentNullException(nameof(map), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - if (uuidWithPattern == null) - throw new ArgumentNullException(nameof(uuidWithPattern), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) + throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime.Value, map, uuid.Value, uuidWithPattern.Value); + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a } /// @@ -219,11 +245,20 @@ public override void Write(Utf8JsonWriter writer, MixedPropertiesAndAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTime.ToString(DateTimeFormat)); - writer.WritePropertyName("map"); - JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.Uuid); - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPattern); + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet && mixedPropertiesAndAdditionalPropertiesClass.Map == null) + throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); + + if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + writer.WritePropertyName("map"); + JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); // 11 + + if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 7969b9ae04ed..6f84537a55ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class Model200Response : IValidatableObject /// varClass /// name [JsonConstructor] - public Model200Response(string varClass, int name) + public Model200Response(Option varClass = default, Option name = default) { - VarClass = varClass; - Name = name; + VarClassOption = varClass; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClass + /// + [JsonIgnore] + public Option VarClassOption { get; private set; } // option d + /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get; set; } + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int Name { get; set; } + public int? Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClass = default; - int? name = default; + Option varClass = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "class": - varClass = utf8JsonReader.GetString(); + varClass = new Option(utf8JsonReader.GetString()); break; case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - name = utf8JsonReader.GetInt32(); + name = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -140,13 +153,13 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varClass == null) - throw new ArgumentNullException(nameof(varClass), "Property is required for class Model200Response."); + if (varClass.IsSet && varClass.Value == null) + throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class Model200Response."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Model200Response."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name.Value); + return new Model200Response(varClass, name); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, Model200Response model200Respo /// public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200Response, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("class", model200Response.VarClass); - writer.WriteNumber("name", model200Response.Name); + if (model200Response.VarClassOption.IsSet && model200Response.VarClass == null) + throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); + + if (model200Response.VarClassOption.IsSet) + writer.WriteString("class", model200Response.VarClass); // 1 + + if (model200Response.NameOption.IsSet) + writer.WriteNumber("name", model200Response.NameOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index 810a6a01b8e9..cecadeaa6fe7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class ModelClient : IValidatableObject /// /// varClient [JsonConstructor] - public ModelClient(string varClient) + public ModelClient(Option varClient = default) { - VarClient = varClient; + VarClientOption = varClient; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarClient + /// + [JsonIgnore] + public Option VarClientOption { get; private set; } // option d + /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get; set; } + public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varClient = default; + Option varClient = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "client": - varClient = utf8JsonReader.GetString(); + varClient = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (varClient == null) - throw new ArgumentNullException(nameof(varClient), "Property is required for class ModelClient."); + if (varClient.IsSet && varClient.Value == null) + throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); + return new ModelClient(varClient); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, ModelClient modelClient, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("client", modelClient.VarClient); + if (modelClient.VarClientOption.IsSet && modelClient.VarClient == null) + throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); + + if (modelClient.VarClientOption.IsSet) + writer.WriteString("client", modelClient.VarClient); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index edcb6b3403c7..9280a4714418 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,12 +37,12 @@ public partial class Name : IEquatable, IValidatableObject /// snakeCase /// var123Number [JsonConstructor] - public Name(int varName, string property, int snakeCase, int var123Number) + public Name(int varName, Option property = default, Option snakeCase = default, Option var123Number = default) { VarName = varName; - Property = property; - SnakeCase = snakeCase; - Var123Number = var123Number; + PropertyOption = property; + SnakeCaseOption = snakeCase; + Var123NumberOption = var123Number; OnCreated(); } @@ -51,25 +52,43 @@ public Name(int varName, string property, int snakeCase, int var123Number) /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } + public int VarName { get; set; } // d + + /// + /// Used to track the state of Property + /// + [JsonIgnore] + public Option PropertyOption { get; private set; } // option d /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get; set; } + public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new Option(value); } } // d + + /// + /// Used to track the state of SnakeCase + /// + [JsonIgnore] + public Option SnakeCaseOption { get; } // option d /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int SnakeCase { get; } + public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + + /// + /// Used to track the state of Var123Number + /// + [JsonIgnore] + public Option Var123NumberOption { get; } // option d /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int Var123Number { get; } + public int? Var123Number { get { return this. Var123NumberOption; } } // d /// /// Gets or Sets additional properties @@ -123,8 +142,12 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); - hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + if (SnakeCase != null) + hashCode = (hashCode * 59) + SnakeCase.GetHashCode(); + + if (Var123Number != null) + hashCode = (hashCode * 59) + Var123Number.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -164,10 +187,10 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varName = default; - string property = default; - int? snakeCase = default; - int? var123Number = default; + Option varName = default; + Option property = default; + Option snakeCase = default; + Option var123Number = default; while (utf8JsonReader.Read()) { @@ -186,18 +209,18 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "name": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varName = utf8JsonReader.GetInt32(); + varName = new Option(utf8JsonReader.GetInt32()); break; case "property": - property = utf8JsonReader.GetString(); + property = new Option(utf8JsonReader.GetString()); break; case "snake_case": if (utf8JsonReader.TokenType != JsonTokenType.Null) - snakeCase = utf8JsonReader.GetInt32(); + snakeCase = new Option(utf8JsonReader.GetInt32()); break; case "123Number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - var123Number = utf8JsonReader.GetInt32(); + var123Number = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -205,19 +228,22 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (varName == null) - throw new ArgumentNullException(nameof(varName), "Property is required for class Name."); + if (!varName.IsSet) + throw new ArgumentException("Property is required for class Name.", nameof(varName)); + + if (varName.IsSet && varName.Value == null) + throw new ArgumentNullException(nameof(varName), "Property is not nullable for class Name."); - if (property == null) - throw new ArgumentNullException(nameof(property), "Property is required for class Name."); + if (property.IsSet && property.Value == null) + throw new ArgumentNullException(nameof(property), "Property is not nullable for class Name."); - if (snakeCase == null) - throw new ArgumentNullException(nameof(snakeCase), "Property is required for class Name."); + if (snakeCase.IsSet && snakeCase.Value == null) + throw new ArgumentNullException(nameof(snakeCase), "Property is not nullable for class Name."); - if (var123Number == null) - throw new ArgumentNullException(nameof(var123Number), "Property is required for class Name."); + if (var123Number.IsSet && var123Number.Value == null) + throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value, property, snakeCase.Value, var123Number.Value); + return new Name(varName.Value.Value, property, snakeCase, var123Number); // a } /// @@ -244,10 +270,19 @@ public override void Write(Utf8JsonWriter writer, Name name, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("name", name.VarName); - writer.WriteString("property", name.Property); - writer.WriteNumber("snake_case", name.SnakeCase); - writer.WriteNumber("123Number", name.Var123Number); + if (name.PropertyOption.IsSet && name.Property == null) + throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); + + writer.WriteNumber("name", name.VarName); // 3 + + if (name.PropertyOption.IsSet) + writer.WriteString("property", name.Property); // 1 + + if (name.SnakeCaseOption.IsSet) + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); // 3 + + if (name.Var123NumberOption.IsSet) + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 83ab7f40b1e8..e91111bfa6af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } + public List> AObjVariableobject { get; set; } // d /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } + public int PkiNotificationtestID { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List> aObjVariableobject = default; - int? pkiNotificationtestID = default; + Option>> aObjVariableobject = default; + Option pkiNotificationtestID = default; while (utf8JsonReader.Read()) { @@ -129,11 +130,11 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR { case "a_objVariableobject": if (utf8JsonReader.TokenType != JsonTokenType.Null) - aObjVariableobject = JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions); + aObjVariableobject = new Option>>(JsonSerializer.Deserialize>>(ref utf8JsonReader, jsonSerializerOptions)); break; case "pkiNotificationtestID": if (utf8JsonReader.TokenType != JsonTokenType.Null) - pkiNotificationtestID = utf8JsonReader.GetInt32(); + pkiNotificationtestID = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -141,13 +142,19 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR } } - if (aObjVariableobject == null) - throw new ArgumentNullException(nameof(aObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!aObjVariableobject.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(aObjVariableobject)); - if (pkiNotificationtestID == null) - throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + if (!pkiNotificationtestID.IsSet) + throw new ArgumentException("Property is required for class NotificationtestGetElementsV1ResponseMPayload.", nameof(pkiNotificationtestID)); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject, pkiNotificationtestID.Value); + if (aObjVariableobject.IsSet && aObjVariableobject.Value == null) + throw new ArgumentNullException(nameof(aObjVariableobject), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) + throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); + + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); // a } /// @@ -174,9 +181,12 @@ public override void Write(Utf8JsonWriter writer, NotificationtestGetElementsV1R /// public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElementsV1ResponseMPayload notificationtestGetElementsV1ResponseMPayload, JsonSerializerOptions jsonSerializerOptions) { + if (notificationtestGetElementsV1ResponseMPayload.AObjVariableobject == null) + throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); + writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 5d9de18c4a36..001b0385cbb0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,96 +45,168 @@ public partial class NullableClass : Dictionary, IValidatableObj /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(List arrayItemsNullable, Dictionary objectItemsNullable, List arrayAndItemsNullableProp = default, List arrayNullableProp = default, bool? booleanProp = default, DateTime? dateProp = default, DateTime? datetimeProp = default, int? integerProp = default, decimal? numberProp = default, Dictionary objectAndItemsNullableProp = default, Dictionary objectNullableProp = default, string stringProp = default) : base() + public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullable = arrayItemsNullable; - ObjectItemsNullable = objectItemsNullable; - ArrayAndItemsNullableProp = arrayAndItemsNullableProp; - ArrayNullableProp = arrayNullableProp; - BooleanProp = booleanProp; - DateProp = dateProp; - DatetimeProp = datetimeProp; - IntegerProp = integerProp; - NumberProp = numberProp; - ObjectAndItemsNullableProp = objectAndItemsNullableProp; - ObjectNullableProp = objectNullableProp; - StringProp = stringProp; + ArrayItemsNullableOption = arrayItemsNullable; + ObjectItemsNullableOption = objectItemsNullable; + ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayNullablePropOption = arrayNullableProp; + BooleanPropOption = booleanProp; + DatePropOption = dateProp; + DatetimePropOption = datetimeProp; + IntegerPropOption = integerProp; + NumberPropOption = numberProp; + ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectNullablePropOption = objectNullableProp; + StringPropOption = stringProp; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of ArrayItemsNullable + /// + [JsonIgnore] + public Option> ArrayItemsNullableOption { get; private set; } // option d + /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get; set; } + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new Option>(value); } } // d + + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + public Option> ObjectItemsNullableOption { get; private set; } // option d /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get; set; } + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new Option>(value); } } // d + + /// + /// Used to track the state of ArrayAndItemsNullableProp + /// + [JsonIgnore] + public Option> ArrayAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get; set; } + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new Option>(value); } } // d + + /// + /// Used to track the state of ArrayNullableProp + /// + [JsonIgnore] + public Option> ArrayNullablePropOption { get; private set; } // option d /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get; set; } + public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new Option>(value); } } // d + + /// + /// Used to track the state of BooleanProp + /// + [JsonIgnore] + public Option BooleanPropOption { get; private set; } // option d /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get; set; } + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new Option(value); } } // d + + /// + /// Used to track the state of DateProp + /// + [JsonIgnore] + public Option DatePropOption { get; private set; } // option d /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get; set; } + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new Option(value); } } // d + + /// + /// Used to track the state of DatetimeProp + /// + [JsonIgnore] + public Option DatetimePropOption { get; private set; } // option d /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get; set; } + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new Option(value); } } // d + + /// + /// Used to track the state of IntegerProp + /// + [JsonIgnore] + public Option IntegerPropOption { get; private set; } // option d /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get; set; } + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NumberProp + /// + [JsonIgnore] + public Option NumberPropOption { get; private set; } // option d /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get; set; } + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new Option(value); } } // d + + /// + /// Used to track the state of ObjectAndItemsNullableProp + /// + [JsonIgnore] + public Option> ObjectAndItemsNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get; set; } + public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new Option>(value); } } // d + + /// + /// Used to track the state of ObjectNullableProp + /// + [JsonIgnore] + public Option> ObjectNullablePropOption { get; private set; } // option d /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get; set; } + public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new Option>(value); } } // d + + /// + /// Used to track the state of StringProp + /// + [JsonIgnore] + public Option StringPropOption { get; private set; } // option d /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get; set; } + public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -220,18 +293,18 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List arrayItemsNullable = default; - Dictionary objectItemsNullable = default; - List arrayAndItemsNullableProp = default; - List arrayNullableProp = default; - bool? booleanProp = default; - DateTime? dateProp = default; - DateTime? datetimeProp = default; - int? integerProp = default; - decimal? numberProp = default; - Dictionary objectAndItemsNullableProp = default; - Dictionary objectNullableProp = default; - string stringProp = default; + Option> arrayItemsNullable = default; + Option> objectItemsNullable = default; + Option> arrayAndItemsNullableProp = default; + Option> arrayNullableProp = default; + Option booleanProp = default; + Option dateProp = default; + Option datetimeProp = default; + Option integerProp = default; + Option numberProp = default; + Option> objectAndItemsNullableProp = default; + Option> objectNullableProp = default; + Option stringProp = default; while (utf8JsonReader.Read()) { @@ -250,50 +323,50 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT { case "array_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_items_nullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectItemsNullable = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectItemsNullable = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "boolean_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - booleanProp = utf8JsonReader.GetBoolean(); + booleanProp = new Option(utf8JsonReader.GetBoolean()); break; case "date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - dateProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + dateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "datetime_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - datetimeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + datetimeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "integer_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - integerProp = utf8JsonReader.GetInt32(); + integerProp = new Option(utf8JsonReader.GetInt32()); break; case "number_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - numberProp = utf8JsonReader.GetDecimal(); + numberProp = new Option(utf8JsonReader.GetDecimal()); break; case "object_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectAndItemsNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectAndItemsNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectNullableProp = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "string_prop": - stringProp = utf8JsonReader.GetString(); + stringProp = new Option(utf8JsonReader.GetString()); break; default: break; @@ -301,13 +374,13 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (arrayItemsNullable == null) - throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is required for class NullableClass."); + if (arrayItemsNullable.IsSet && arrayItemsNullable.Value == null) + throw new ArgumentNullException(nameof(arrayItemsNullable), "Property is not nullable for class NullableClass."); - if (objectItemsNullable == null) - throw new ArgumentNullException(nameof(objectItemsNullable), "Property is required for class NullableClass."); + if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) + throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a } /// @@ -334,45 +407,85 @@ public override void Write(Utf8JsonWriter writer, NullableClass nullableClass, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableClass, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - writer.WritePropertyName("array_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("array_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); - - if (nullableClass.BooleanProp != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanProp.Value); - else - writer.WriteNull("boolean_prop"); - - if (nullableClass.DateProp != null) - writer.WriteString("date_prop", nullableClass.DateProp.Value.ToString(DatePropFormat)); - else - writer.WriteNull("date_prop"); - - if (nullableClass.DatetimeProp != null) - writer.WriteString("datetime_prop", nullableClass.DatetimeProp.Value.ToString(DatetimePropFormat)); - else - writer.WriteNull("datetime_prop"); - - if (nullableClass.IntegerProp != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerProp.Value); - else - writer.WriteNull("integer_prop"); - - if (nullableClass.NumberProp != null) - writer.WriteNumber("number_prop", nullableClass.NumberProp.Value); - else - writer.WriteNull("number_prop"); - - writer.WritePropertyName("object_and_items_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); - writer.WritePropertyName("object_nullable_prop"); - JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); - writer.WriteString("string_prop", nullableClass.StringProp); + if (nullableClass.ArrayItemsNullableOption.IsSet && nullableClass.ArrayItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ArrayItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) + throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); + + if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("array_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.Value != null) + { + writer.WritePropertyName("array_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ArrayNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("array_nullable_prop"); + if (nullableClass.BooleanPropOption.IsSet) + if (nullableClass.BooleanPropOption.Value != null) + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); // 2 + else + writer.WriteNull("boolean_prop"); + + if (nullableClass.DatePropOption.IsSet) + if (nullableClass.DatePropOption.Value != null) + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); // 4 + else + writer.WriteNull("date_prop"); + + if (nullableClass.DatetimePropOption.IsSet) + if (nullableClass.DatetimePropOption.Value != null) + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); // 5 + else + writer.WriteNull("datetime_prop"); + + if (nullableClass.IntegerPropOption.IsSet) + if (nullableClass.IntegerPropOption.Value != null) + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); // 3 + else + writer.WriteNull("integer_prop"); + + if (nullableClass.NumberPropOption.IsSet) + if (nullableClass.NumberPropOption.Value != null) + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); // 3 + else + writer.WriteNull("number_prop"); + + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) + { + writer.WritePropertyName("object_and_items_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectAndItemsNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.Value != null) + { + writer.WritePropertyName("object_nullable_prop"); + JsonSerializer.Serialize(writer, nullableClass.ObjectNullableProp, jsonSerializerOptions); + } + else + writer.WriteNull("object_nullable_prop"); + if (nullableClass.StringPropOption.IsSet) + if (nullableClass.StringPropOption.Value != null) + writer.WriteString("string_prop", nullableClass.StringProp); // 1 + else + writer.WriteNull("string_prop"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 684109acd50f..2bb4129d90a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,20 +34,26 @@ public partial class NullableGuidClass : IValidatableObject /// /// uuid [JsonConstructor] - public NullableGuidClass(Guid? uuid = default) + public NullableGuidClass(Option uuid = default) { - Uuid = uuid; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d + /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get; set; } + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -101,7 +108,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Guid? uuid = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -120,7 +127,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t { case "uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - uuid = utf8JsonReader.GetGuid(); + uuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -128,7 +135,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); + return new NullableGuidClass(uuid); // a } /// @@ -155,11 +162,11 @@ public override void Write(Utf8JsonWriter writer, NullableGuidClass nullableGuid /// public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullableGuidClass, JsonSerializerOptions jsonSerializerOptions) { - - if (nullableGuidClass.Uuid == null) - writer.WriteNull("uuid"); - else - writer.WriteString("uuid", nullableGuidClass.Uuid.Value); + if (nullableGuidClass.UuidOption.IsSet) + if (nullableGuidClass.UuidOption.Value != null) + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); // 11 + else + writer.WriteNull("uuid"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs index a44c950b81bb..de01979e880b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class NullableShape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class NullableShape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType); + return new NullableShape(quadrilateral, shapeType.Value); // c if (triangle != null) - return new NullableShape(triangle, shapeType); + return new NullableShape(triangle, shapeType.Value); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, NullableShape nullableShape, J /// public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableShape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", nullableShape.ShapeType); + if (nullableShape.ShapeType == null) + throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); + + writer.WriteString("shapeType", nullableShape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 3f3cbf4c5059..89fd93376675 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class NumberOnly : IValidatableObject /// /// justNumber [JsonConstructor] - public NumberOnly(decimal justNumber) + public NumberOnly(Option justNumber = default) { - JustNumber = justNumber; + JustNumberOption = justNumber; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of JustNumber + /// + [JsonIgnore] + public Option JustNumberOption { get; private set; } // option d + /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal JustNumber { get; set; } + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo JsonTokenType startingTokenType = utf8JsonReader.TokenType; - decimal? justNumber = default; + Option justNumber = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo { case "JustNumber": if (utf8JsonReader.TokenType != JsonTokenType.Null) - justNumber = utf8JsonReader.GetDecimal(); + justNumber = new Option(utf8JsonReader.GetDecimal()); break; default: break; @@ -127,10 +134,10 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo } } - if (justNumber == null) - throw new ArgumentNullException(nameof(justNumber), "Property is required for class NumberOnly."); + if (justNumber.IsSet && justNumber.Value == null) + throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber.Value); + return new NumberOnly(justNumber); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer /// public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("JustNumber", numberOnly.JustNumber); + if (numberOnly.JustNumberOption.IsSet) + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 57a1614f29f4..ea61607836b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -36,43 +37,67 @@ public partial class ObjectWithDeprecatedFields : IValidatableObject /// id /// uuid [JsonConstructor] - public ObjectWithDeprecatedFields(List bars, DeprecatedObject deprecatedRef, decimal id, string uuid) + public ObjectWithDeprecatedFields(Option> bars = default, Option deprecatedRef = default, Option id = default, Option uuid = default) { - Bars = bars; - DeprecatedRef = deprecatedRef; - Id = id; - Uuid = uuid; + BarsOption = bars; + DeprecatedRefOption = deprecatedRef; + IdOption = id; + UuidOption = uuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bars + /// + [JsonIgnore] + public Option> BarsOption { get; private set; } // option d + /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get; set; } + public List Bars { get { return this. BarsOption; } set { this.BarsOption = new Option>(value); } } // d + + /// + /// Used to track the state of DeprecatedRef + /// + [JsonIgnore] + public Option DeprecatedRefOption { get; private set; } // option d /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get; set; } + public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new Option(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal Id { get; set; } + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + + /// + /// Used to track the state of Uuid + /// + [JsonIgnore] + public Option UuidOption { get; private set; } // option d /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get; set; } + public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -130,10 +155,10 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List bars = default; - DeprecatedObject deprecatedRef = default; - decimal? id = default; - string uuid = default; + Option> bars = default; + Option deprecatedRef = default; + Option id = default; + Option uuid = default; while (utf8JsonReader.Read()) { @@ -152,18 +177,18 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade { case "bars": if (utf8JsonReader.TokenType != JsonTokenType.Null) - bars = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + bars = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; case "deprecatedRef": if (utf8JsonReader.TokenType != JsonTokenType.Null) - deprecatedRef = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + deprecatedRef = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetDecimal(); + id = new Option(utf8JsonReader.GetDecimal()); break; case "uuid": - uuid = utf8JsonReader.GetString(); + uuid = new Option(utf8JsonReader.GetString()); break; default: break; @@ -171,19 +196,19 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade } } - if (bars == null) - throw new ArgumentNullException(nameof(bars), "Property is required for class ObjectWithDeprecatedFields."); + if (bars.IsSet && bars.Value == null) + throw new ArgumentNullException(nameof(bars), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (deprecatedRef == null) - throw new ArgumentNullException(nameof(deprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + if (deprecatedRef.IsSet && deprecatedRef.Value == null) + throw new ArgumentNullException(nameof(deprecatedRef), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class ObjectWithDeprecatedFields."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class ObjectWithDeprecatedFields."); - if (uuid == null) - throw new ArgumentNullException(nameof(uuid), "Property is required for class ObjectWithDeprecatedFields."); + if (uuid.IsSet && uuid.Value == null) + throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id.Value, uuid); + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a } /// @@ -210,12 +235,26 @@ public override void Write(Utf8JsonWriter writer, ObjectWithDeprecatedFields obj /// public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedFields objectWithDeprecatedFields, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("bars"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - writer.WritePropertyName("deprecatedRef"); - JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); - writer.WriteNumber("id", objectWithDeprecatedFields.Id); - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); + if (objectWithDeprecatedFields.BarsOption.IsSet && objectWithDeprecatedFields.Bars == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Bars), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet && objectWithDeprecatedFields.DeprecatedRef == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.DeprecatedRef), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) + throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); + + if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + writer.WritePropertyName("bars"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + writer.WritePropertyName("deprecatedRef"); + JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + if (objectWithDeprecatedFields.IdOption.IsSet) + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); // 3 + + if (objectWithDeprecatedFields.UuidOption.IsSet) + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs index 91dd67631614..99d1c17f0843 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -121,10 +122,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b if (varString != null) - return new OneOfString(varString); + return new OneOfString(varString); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index 3258ff154478..f0380c6d7930 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -38,14 +39,14 @@ public partial class Order : IValidatableObject /// Order Status /// complete (default to false) [JsonConstructor] - public Order(long id, long petId, int quantity, DateTime shipDate, StatusEnum status, bool complete = false) + public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) { - Id = id; - PetId = petId; - Quantity = quantity; - ShipDate = shipDate; - Status = status; - Complete = complete; + IdOption = id; + PetIdOption = petId; + QuantityOption = quantity; + ShipDateOption = shipDate; + StatusOption = status; + CompleteOption = complete; OnCreated(); } @@ -118,9 +119,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Placed) return "placed"; @@ -133,43 +133,79 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } // a + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + + /// + /// Used to track the state of PetId + /// + [JsonIgnore] + public Option PetIdOption { get; private set; } // option d /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long PetId { get; set; } + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new Option(value); } } // d + + /// + /// Used to track the state of Quantity + /// + [JsonIgnore] + public Option QuantityOption { get; private set; } // option d /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int Quantity { get; set; } + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new Option(value); } } // d + + /// + /// Used to track the state of ShipDate + /// + [JsonIgnore] + public Option ShipDateOption { get; private set; } // option d /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime ShipDate { get; set; } + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new Option(value); } } // d + + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + public Option CompleteOption { get; private set; } // option d /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool Complete { get; set; } + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -234,12 +270,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - long? petId = default; - int? quantity = default; - DateTime? shipDate = default; - Order.StatusEnum? status = default; - bool? complete = default; + Option id = default; + Option petId = default; + Option quantity = default; + Option shipDate = default; + Option status = default; + Option complete = default; while (utf8JsonReader.Read()) { @@ -258,29 +294,28 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "petId": if (utf8JsonReader.TokenType != JsonTokenType.Null) - petId = utf8JsonReader.GetInt64(); + petId = new Option(utf8JsonReader.GetInt64()); break; case "quantity": if (utf8JsonReader.TokenType != JsonTokenType.Null) - quantity = utf8JsonReader.GetInt32(); + quantity = new Option(utf8JsonReader.GetInt32()); break; case "shipDate": if (utf8JsonReader.TokenType != JsonTokenType.Null) - shipDate = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + shipDate = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Order.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; case "complete": if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = utf8JsonReader.GetBoolean(); + complete = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -288,25 +323,25 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Order."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); - if (petId == null) - throw new ArgumentNullException(nameof(petId), "Property is required for class Order."); + if (petId.IsSet && petId.Value == null) + throw new ArgumentNullException(nameof(petId), "Property is not nullable for class Order."); - if (quantity == null) - throw new ArgumentNullException(nameof(quantity), "Property is required for class Order."); + if (quantity.IsSet && quantity.Value == null) + throw new ArgumentNullException(nameof(quantity), "Property is not nullable for class Order."); - if (shipDate == null) - throw new ArgumentNullException(nameof(shipDate), "Property is required for class Order."); + if (shipDate.IsSet && shipDate.Value == null) + throw new ArgumentNullException(nameof(shipDate), "Property is not nullable for class Order."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Order."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete == null) - throw new ArgumentNullException(nameof(complete), "Property is required for class Order."); + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id.Value, petId.Value, quantity.Value, shipDate.Value, status.Value, complete.Value); + return new Order(id, petId, quantity, shipDate, status, complete); // a } /// @@ -333,18 +368,26 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", order.Id); - writer.WriteNumber("petId", order.PetId); - writer.WriteNumber("quantity", order.Quantity); - writer.WriteString("shipDate", order.ShipDate.ToString(ShipDateFormat)); + if (order.IdOption.IsSet) + writer.WriteNumber("id", order.IdOption.Value.Value); // 3 + + if (order.PetIdOption.IsSet) + writer.WriteNumber("petId", order.PetIdOption.Value.Value); // 3 + + if (order.QuantityOption.IsSet) + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); // 3 + + if (order.ShipDateOption.IsSet) + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); // 5 - var statusRawValue = Order.StatusEnumToJsonValue(order.Status); + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WriteBoolean("complete", order.Complete); + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index c37883db124b..5dac340991b8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,33 +36,51 @@ public partial class OuterComposite : IValidatableObject /// myNumber /// myString [JsonConstructor] - public OuterComposite(bool myBoolean, decimal myNumber, string myString) + public OuterComposite(Option myBoolean = default, Option myNumber = default, Option myString = default) { - MyBoolean = myBoolean; - MyNumber = myNumber; - MyString = myString; + MyBooleanOption = myBoolean; + MyNumberOption = myNumber; + MyStringOption = myString; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of MyBoolean + /// + [JsonIgnore] + public Option MyBooleanOption { get; private set; } // option d + /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool MyBoolean { get; set; } + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new Option(value); } } // d + + /// + /// Used to track the state of MyNumber + /// + [JsonIgnore] + public Option MyNumberOption { get; private set; } // option d /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal MyNumber { get; set; } + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new Option(value); } } // d + + /// + /// Used to track the state of MyString + /// + [JsonIgnore] + public Option MyStringOption { get; private set; } // option d /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get; set; } + public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +137,9 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - bool? myBoolean = default; - decimal? myNumber = default; - string myString = default; + Option myBoolean = default; + Option myNumber = default; + Option myString = default; while (utf8JsonReader.Read()) { @@ -139,14 +158,14 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type { case "my_boolean": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myBoolean = utf8JsonReader.GetBoolean(); + myBoolean = new Option(utf8JsonReader.GetBoolean()); break; case "my_number": if (utf8JsonReader.TokenType != JsonTokenType.Null) - myNumber = utf8JsonReader.GetDecimal(); + myNumber = new Option(utf8JsonReader.GetDecimal()); break; case "my_string": - myString = utf8JsonReader.GetString(); + myString = new Option(utf8JsonReader.GetString()); break; default: break; @@ -154,16 +173,16 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (myBoolean == null) - throw new ArgumentNullException(nameof(myBoolean), "Property is required for class OuterComposite."); + if (myBoolean.IsSet && myBoolean.Value == null) + throw new ArgumentNullException(nameof(myBoolean), "Property is not nullable for class OuterComposite."); - if (myNumber == null) - throw new ArgumentNullException(nameof(myNumber), "Property is required for class OuterComposite."); + if (myNumber.IsSet && myNumber.Value == null) + throw new ArgumentNullException(nameof(myNumber), "Property is not nullable for class OuterComposite."); - if (myString == null) - throw new ArgumentNullException(nameof(myString), "Property is required for class OuterComposite."); + if (myString.IsSet && myString.Value == null) + throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean.Value, myNumber.Value, myString); + return new OuterComposite(myBoolean, myNumber, myString); // a } /// @@ -190,9 +209,17 @@ public override void Write(Utf8JsonWriter writer, OuterComposite outerComposite, /// public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerComposite, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteBoolean("my_boolean", outerComposite.MyBoolean); - writer.WriteNumber("my_number", outerComposite.MyNumber); - writer.WriteString("my_string", outerComposite.MyString); + if (outerComposite.MyStringOption.IsSet && outerComposite.MyString == null) + throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); + + if (outerComposite.MyBooleanOption.IsSet) + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); // 2 + + if (outerComposite.MyNumberOption.IsSet) + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); // 3 + + if (outerComposite.MyStringOption.IsSet) + writer.WriteString("my_string", outerComposite.MyString); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs index a4ec335bb386..47bb6793c6ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs index 7c67db5ddca3..136fb4c54c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs index 84ea65297ab0..2ed4f18a657e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumInteger.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs index 983d194a1998..c6a470cc64d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumIntegerDefaultValue.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs index 51d8bee407e0..a2e789f2edef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterEnumTest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs index eb0129c6ce0f..9c292f10c059 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -76,7 +77,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string petType = default; + Option petType = default; while (utf8JsonReader.Read()) { @@ -94,7 +95,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon switch (localVarJsonPropertyName) { case "pet_type": - petType = utf8JsonReader.GetString(); + petType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -102,10 +103,13 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon } } - if (petType == null) - throw new ArgumentNullException(nameof(petType), "Property is required for class ParentPet."); + if (!petType.IsSet) + throw new ArgumentException("Property is required for class ParentPet.", nameof(petType)); - return new ParentPet(petType); + if (petType.IsSet && petType.Value == null) + throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); + + return new ParentPet(petType.Value); // a } /// @@ -132,7 +136,10 @@ public override void Write(Utf8JsonWriter writer, ParentPet parentPet, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("pet_type", parentPet.PetType); + if (parentPet.PetType == null) + throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); + + writer.WriteString("pet_type", parentPet.PetType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 225a9c5328c0..bb1eb881038a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -31,21 +32,21 @@ public partial class Pet : IValidatableObject /// /// Initializes a new instance of the class. /// - /// category - /// id /// name /// photoUrls + /// category + /// id /// pet status in the store /// tags [JsonConstructor] - public Pet(Category category, long id, string name, List photoUrls, StatusEnum status, List tags) + public Pet(string name, List photoUrls, Option category = default, Option id = default, Option status = default, Option> tags = default) { - Category = category; - Id = id; Name = name; PhotoUrls = photoUrls; - Status = status; - Tags = tags; + CategoryOption = category; + IdOption = id; + StatusOption = status; + TagsOption = tags; OnCreated(); } @@ -118,9 +119,8 @@ public static StatusEnum StatusEnumFromString(string value) /// /// /// - public static string StatusEnumToJsonValue(StatusEnum value) + public static string StatusEnumToJsonValue(StatusEnum? value) { - if (value == StatusEnum.Available) return "available"; @@ -133,43 +133,67 @@ public static string StatusEnumToJsonValue(StatusEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Status + /// + [JsonIgnore] + public Option StatusOption { get; private set; } // option a + /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum Status { get; set; } + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } // a + + /// + /// Gets or Sets Name + /// + /// doggie + [JsonPropertyName("name")] + public string Name { get; set; } // d + + /// + /// Gets or Sets PhotoUrls + /// + [JsonPropertyName("photoUrls")] + public List PhotoUrls { get; set; } // d + + /// + /// Used to track the state of Category + /// + [JsonIgnore] + public Option CategoryOption { get; private set; } // option d /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get; set; } + public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new Option(value); } } // d /// - /// Gets or Sets Id + /// Used to track the state of Id /// - [JsonPropertyName("id")] - public long Id { get; set; } + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// - /// Gets or Sets Name + /// Gets or Sets Id /// - /// doggie - [JsonPropertyName("name")] - public string Name { get; set; } + [JsonPropertyName("id")] + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d /// - /// Gets or Sets PhotoUrls + /// Used to track the state of Tags /// - [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } + [JsonIgnore] + public Option> TagsOption { get; private set; } // option d /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get; set; } + public List Tags { get { return this. TagsOption; } set { this.TagsOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -185,10 +209,10 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); sb.Append(" Tags: ").Append(Tags).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -229,12 +253,12 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Category category = default; - long? id = default; - string name = default; - List photoUrls = default; - Pet.StatusEnum? status = default; - List tags = default; + Option name = default; + Option> photoUrls = default; + Option category = default; + Option id = default; + Option status = default; + Option> tags = default; while (utf8JsonReader.Read()) { @@ -251,30 +275,29 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { - case "category": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - category = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + case "name": + name = new Option(utf8JsonReader.GetString()); break; - case "id": + case "photoUrls": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + photoUrls = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "name": - name = utf8JsonReader.GetString(); + case "category": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + category = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "photoUrls": + case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - photoUrls = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + id = new Option(utf8JsonReader.GetInt64()); break; case "status": string statusRawValue = utf8JsonReader.GetString(); - status = statusRawValue == null - ? null - : Pet.StatusEnumFromStringOrDefault(statusRawValue); + if (statusRawValue != null) + status = new Option(Pet.StatusEnumFromStringOrDefault(statusRawValue)); break; case "tags": if (utf8JsonReader.TokenType != JsonTokenType.Null) - tags = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + tags = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -282,25 +305,31 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (category == null) - throw new ArgumentNullException(nameof(category), "Property is required for class Pet."); + if (!name.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(name)); + + if (!photoUrls.IsSet) + throw new ArgumentException("Property is required for class Pet.", nameof(photoUrls)); + + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Pet."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Pet."); + if (photoUrls.IsSet && photoUrls.Value == null) + throw new ArgumentNullException(nameof(photoUrls), "Property is not nullable for class Pet."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Pet."); + if (category.IsSet && category.Value == null) + throw new ArgumentNullException(nameof(category), "Property is not nullable for class Pet."); - if (photoUrls == null) - throw new ArgumentNullException(nameof(photoUrls), "Property is required for class Pet."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Pet."); - if (status == null) - throw new ArgumentNullException(nameof(status), "Property is required for class Pet."); + if (status.IsSet && status.Value == null) + throw new ArgumentNullException(nameof(status), "Property is not nullable for class Pet."); - if (tags == null) - throw new ArgumentNullException(nameof(tags), "Property is required for class Pet."); + if (tags.IsSet && tags.Value == null) + throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(category, id.Value, name, photoUrls, status.Value, tags); + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); // a } /// @@ -327,21 +356,37 @@ public override void Write(Utf8JsonWriter writer, Pet pet, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("category"); - JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); - writer.WriteNumber("id", pet.Id); - writer.WriteString("name", pet.Name); - writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.Name == null) + throw new ArgumentNullException(nameof(pet.Name), "Property is required for class Pet."); + + if (pet.PhotoUrls == null) + throw new ArgumentNullException(nameof(pet.PhotoUrls), "Property is required for class Pet."); + + if (pet.CategoryOption.IsSet && pet.Category == null) + throw new ArgumentNullException(nameof(pet.Category), "Property is required for class Pet."); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.Status); + if (pet.TagsOption.IsSet && pet.Tags == null) + throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); + + writer.WriteString("name", pet.Name); // 1 + + writer.WritePropertyName("photoUrls"); + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 + if (pet.CategoryOption.IsSet) // 14 + writer.WritePropertyName("category"); + JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + if (pet.IdOption.IsSet) + writer.WriteNumber("id", pet.IdOption.Value.Value); // 3 + + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - writer.WritePropertyName("tags"); - JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + if (pet.TagsOption.IsSet) // 14 + writer.WritePropertyName("tags"); + JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs index 8185d643e794..f1eb3e0e3145 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; + Option className = default; BasquePig basquePig = null; DanishPig danishPig = null; @@ -184,7 +185,7 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Pig."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Pig.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className); + return new Pig(basquePig, className.Value); // c if (danishPig != null) - return new Pig(danishPig, className); + return new Pig(danishPig, className.Value); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Pig pig, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", pig.ClassName); + if (pig.ClassName == null) + throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); + + writer.WriteString("className", pig.ClassName); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 3a89a8716e07..78791de532b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -194,16 +195,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); + return new PolymorphicProperty(varBool); // b if (varString != null) - return new PolymorphicProperty(varString); + return new PolymorphicProperty(varString); // b if (varObject != null) - return new PolymorphicProperty(varObject); + return new PolymorphicProperty(varObject); // b if (list != null) - return new PolymorphicProperty(list); + return new PolymorphicProperty(list); // b throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 65f7b8b4536f..2c238cd4ce3a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; ComplexQuadrilateral complexQuadrilateral = null; SimpleQuadrilateral simpleQuadrilateral = null; @@ -184,7 +185,7 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class Quadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class Quadrilateral.", nameof(quadrilateralType)); + + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType); + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); // c if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType); + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Quadrilateral quadrilateral, J /// public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); + if (quadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); + + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index c329eed3266b..69c52bc4bafc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; + Option quadrilateralType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class QuadrilateralInterface."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class QuadrilateralInterface.", nameof(quadrilateralType)); - return new QuadrilateralInterface(quadrilateralType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); + + return new QuadrilateralInterface(quadrilateralType.Value); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, QuadrilateralInterface quadril /// public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface quadrilateralInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); + if (quadrilateralInterface.QuadrilateralType == null) + throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); + + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 2c8b4fff43d6..bf0449857edb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class ReadOnlyFirst : IEquatable, IValidatableObje /// bar /// baz [JsonConstructor] - public ReadOnlyFirst(string bar, string baz) + public ReadOnlyFirst(Option bar = default, Option baz = default) { - Bar = bar; - Baz = baz; + BarOption = bar; + BazOption = baz; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Bar + /// + [JsonIgnore] + public Option BarOption { get; } // option d + /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get; } + public string Bar { get { return this. BarOption; } } // d + + /// + /// Used to track the state of Baz + /// + [JsonIgnore] + public Option BazOption { get; private set; } // option d /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get; set; } + public string Baz { get { return this. BazOption; } set { this.BazOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -105,7 +118,9 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - hashCode = (hashCode * 59) + Bar.GetHashCode(); + if (Bar != null) + hashCode = (hashCode * 59) + Bar.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); return hashCode; @@ -145,8 +160,8 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string bar = default; - string baz = default; + Option bar = default; + Option baz = default; while (utf8JsonReader.Read()) { @@ -164,10 +179,10 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { case "bar": - bar = utf8JsonReader.GetString(); + bar = new Option(utf8JsonReader.GetString()); break; case "baz": - baz = utf8JsonReader.GetString(); + baz = new Option(utf8JsonReader.GetString()); break; default: break; @@ -175,13 +190,13 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT } } - if (bar == null) - throw new ArgumentNullException(nameof(bar), "Property is required for class ReadOnlyFirst."); + if (bar.IsSet && bar.Value == null) + throw new ArgumentNullException(nameof(bar), "Property is not nullable for class ReadOnlyFirst."); - if (baz == null) - throw new ArgumentNullException(nameof(baz), "Property is required for class ReadOnlyFirst."); + if (baz.IsSet && baz.Value == null) + throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); + return new ReadOnlyFirst(bar, baz); // a } /// @@ -208,8 +223,17 @@ public override void Write(Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, J /// public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFirst, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("bar", readOnlyFirst.Bar); - writer.WriteString("baz", readOnlyFirst.Baz); + if (readOnlyFirst.BarOption.IsSet && readOnlyFirst.Bar == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Bar), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BazOption.IsSet && readOnlyFirst.Baz == null) + throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); + + if (readOnlyFirst.BarOption.IsSet) + writer.WriteString("bar", readOnlyFirst.Bar); // 1 + + if (readOnlyFirst.BazOption.IsSet) + writer.WriteString("baz", readOnlyFirst.Baz); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..143ba25a1d13 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,2362 @@ +// +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Text.Json; +using System.Text.Json.Serialization; +using System.ComponentModel.DataAnnotations; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + public partial class RequiredClass : IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// requiredNotNullableDateProp + /// requiredNotnullableArrayOfString + /// requiredNotnullableBooleanProp + /// requiredNotnullableDatetimeProp + /// requiredNotnullableEnumInteger + /// requiredNotnullableEnumIntegerOnly + /// requiredNotnullableEnumString + /// requiredNotnullableOuterEnumDefaultValue + /// requiredNotnullableStringProp + /// requiredNotnullableUuid + /// requiredNotnullableintegerProp + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid + /// requiredNullableArrayOfString + /// requiredNullableBooleanProp + /// requiredNullableDateProp + /// requiredNullableDatetimeProp + /// requiredNullableEnumInteger + /// requiredNullableEnumIntegerOnly + /// requiredNullableEnumString + /// requiredNullableIntegerProp + /// requiredNullableOuterEnumDefaultValue + /// requiredNullableStringProp + /// requiredNullableUuid + /// notRequiredNullableDateProp + /// notRequiredNullableIntegerProp + /// notrequiredNullableArrayOfString + /// notrequiredNullableBooleanProp + /// notrequiredNullableDatetimeProp + /// notrequiredNullableEnumInteger + /// notrequiredNullableEnumIntegerOnly + /// notrequiredNullableEnumString + /// notrequiredNullableOuterEnumDefaultValue + /// notrequiredNullableStringProp + /// notrequiredNullableUuid + [JsonConstructor] + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + { + RequiredNotNullableDateProp = requiredNotNullableDateProp; + RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + RequiredNotnullableEnumString = requiredNotnullableEnumString; + RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + RequiredNotnullableStringProp = requiredNotnullableStringProp; + RequiredNotnullableUuid = requiredNotnullableUuid; + RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; + RequiredNullableArrayOfString = requiredNullableArrayOfString; + RequiredNullableBooleanProp = requiredNullableBooleanProp; + RequiredNullableDateProp = requiredNullableDateProp; + RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + RequiredNullableEnumInteger = requiredNullableEnumInteger; + RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + RequiredNullableEnumString = requiredNullableEnumString; + RequiredNullableIntegerProp = requiredNullableIntegerProp; + RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + RequiredNullableStringProp = requiredNullableStringProp; + RequiredNullableUuid = requiredNullableUuid; + NotRequiredNullableDatePropOption = notRequiredNullableDateProp; + NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; + NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; + NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; + NotrequiredNullableEnumIntegerOption = notrequiredNullableEnumInteger; + NotrequiredNullableEnumIntegerOnlyOption = notrequiredNullableEnumIntegerOnly; + NotrequiredNullableEnumStringOption = notrequiredNullableEnumString; + NotrequiredNullableOuterEnumDefaultValueOption = notrequiredNullableOuterEnumDefaultValue; + NotrequiredNullableStringPropOption = notrequiredNullableStringProp; + NotrequiredNullableUuidOption = notrequiredNullableUuid; + OnCreated(); + } + + partial void OnCreated(); + + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerEnum? RequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [JsonPropertyName("required_notnullable_enum_integer")] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumIntegerOnlyEnum? RequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("required_notnullable_enum_integer_only")] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNotnullableEnumString + /// + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNotnullableEnumStringEnum RequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNotnullableEnumStringEnum? RequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnullableEnumStringEnum value) + { + if (value == RequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [JsonPropertyName("required_notnullable_enum_string")] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new Option(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new Option(value); } } // a + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNotnullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNotnullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNotnullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + { + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNotnullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNotnullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNotnullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new Option(value); } } // a + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new Option(value); } } // a + + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + + /// + /// Defines RequiredNullableEnumString + /// + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return RequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return RequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return RequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return RequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return RequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return RequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == RequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == RequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == RequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum NotrequiredNullableEnumIntegerEnumFromString(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + { + if (value.Equals((1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_1; + + if (value.Equals((-1).ToString())) + return NotrequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNullableEnumIntegerEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumInteger + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [JsonPropertyName("notrequired_nullable_enum_integer")] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new Option(value); } } // a + + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum NotrequiredNullableEnumIntegerOnlyEnumFromString(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumIntegerOnlyEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + { + if (value.Equals((2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + + if (value.Equals((-2).ToString())) + return NotrequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNullableEnumIntegerOnlyEnum value) + { + return (int) value; + } + + /// + /// Used to track the state of NotrequiredNullableEnumIntegerOnly + /// + [JsonIgnore] + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [JsonPropertyName("notrequired_nullable_enum_integer_only")] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new Option(value); } } // a + + /// + /// Defines NotrequiredNullableEnumString + /// + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + Lower = 2, + + /// + /// Enum Empty for value: + /// + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + Duplicatevalue2 = 8 + } + + /// + /// Returns a + /// + /// + /// + /// + public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnumFromString(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + throw new NotImplementedException($"Could not convert value to type NotrequiredNullableEnumStringEnum: '{value}'"); + } + + /// + /// Returns a + /// + /// + /// + public static NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumStringEnumFromStringOrDefault(string value) + { + if (value.Equals("UPPER")) + return NotrequiredNullableEnumStringEnum.UPPER; + + if (value.Equals("lower")) + return NotrequiredNullableEnumStringEnum.Lower; + + if (value.Equals("")) + return NotrequiredNullableEnumStringEnum.Empty; + + if (value.Equals("Value\twith tab")) + return NotrequiredNullableEnumStringEnum.ValuewithTab; + + if (value.Equals("Value with \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithQuote; + + if (value.Equals("Value with escaped \" quote")) + return NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote; + + if (value.Equals("Duplicate\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue; + + if (value.Equals("Duplicate\r\nvalue")) + return NotrequiredNullableEnumStringEnum.Duplicatevalue2; + + return null; + } + + /// + /// Converts the to the json value + /// + /// + /// + /// + public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNullableEnumStringEnum? value) + { + if (value == null) + return null; + + if (value == NotrequiredNullableEnumStringEnum.UPPER) + return "UPPER"; + + if (value == NotrequiredNullableEnumStringEnum.Lower) + return "lower"; + + if (value == NotrequiredNullableEnumStringEnum.Empty) + return ""; + + if (value == NotrequiredNullableEnumStringEnum.ValuewithTab) + return "Value\twith tab"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithQuote) + return "Value with \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.ValueWithEscapedQuote) + return "Value with escaped \" quote"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue) + return "Duplicate\nvalue"; + + if (value == NotrequiredNullableEnumStringEnum.Duplicatevalue2) + return "Duplicate\r\nvalue"; + + throw new NotImplementedException($"Value could not be handled: '{value}'"); + } + + /// + /// Used to track the state of NotrequiredNullableEnumString + /// + [JsonIgnore] + public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [JsonPropertyName("notrequired_nullable_enum_string")] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new Option(value); } } // a + + /// + /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue + /// + [JsonIgnore] + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new Option(value); } } // a + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [JsonPropertyName("required_not_nullable_date_prop")] + public DateTime RequiredNotNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [JsonPropertyName("required_notnullable_array_of_string")] + public List RequiredNotnullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [JsonPropertyName("required_notnullable_boolean_prop")] + public bool RequiredNotnullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [JsonPropertyName("required_notnullable_datetime_prop")] + public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [JsonPropertyName("required_notnullable_string_prop")] + public string RequiredNotnullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_notnullable_uuid")] + public Guid RequiredNotnullableUuid { get; set; } // d + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [JsonPropertyName("required_notnullableinteger_prop")] + public int RequiredNotnullableintegerProp { get; set; } // d + + /// + /// Used to track the state of NotRequiredNotnullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotRequiredNotnullableintegerProp + /// + [JsonIgnore] + public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableArrayOfString + /// + [JsonIgnore] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new Option>(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNotnullableUuid + /// + [JsonIgnore] + public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option(value); } } // d + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } // d + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } // d + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } // d + + /// + /// Used to track the state of NotRequiredNullableDateProp + /// + [JsonIgnore] + public Option NotRequiredNullableDatePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotRequiredNullableIntegerProp + /// + [JsonIgnore] + public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableArrayOfString + /// + [JsonIgnore] + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [JsonPropertyName("notrequired_nullable_array_of_string")] + public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new Option>(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableBooleanProp + /// + [JsonIgnore] + public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [JsonPropertyName("notrequired_nullable_boolean_prop")] + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableDatetimeProp + /// + [JsonIgnore] + public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [JsonPropertyName("notrequired_nullable_datetime_prop")] + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableStringProp + /// + [JsonIgnore] + public Option NotrequiredNullableStringPropOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [JsonPropertyName("notrequired_nullable_string_prop")] + public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new Option(value); } } // d + + /// + /// Used to track the state of NotrequiredNullableUuid + /// + [JsonIgnore] + public Option NotrequiredNullableUuidOption { get; private set; } // option d + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_nullable_uuid")] + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new Option(value); } } // d + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public Dictionary AdditionalProperties { get; } = new Dictionary(); + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + + /// + /// A Json converter for type + /// + public class RequiredClassJsonConverter : JsonConverter + { + /// + /// The format to use to serialize RequiredNotNullableDateProp + /// + public static string RequiredNotNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNotnullableDatetimeProp + /// + public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize RequiredNullableDateProp + /// + public static string RequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize RequiredNullableDatetimeProp + /// + public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// The format to use to serialize NotRequiredNullableDateProp + /// + public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + + /// + /// The format to use to serialize NotrequiredNullableDatetimeProp + /// + public static string NotrequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + + /// + /// Deserializes json to + /// + /// + /// + /// + /// + /// + public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonSerializerOptions jsonSerializerOptions) + { + int currentDepth = utf8JsonReader.CurrentDepth; + + if (utf8JsonReader.TokenType != JsonTokenType.StartObject && utf8JsonReader.TokenType != JsonTokenType.StartArray) + throw new JsonException(); + + JsonTokenType startingTokenType = utf8JsonReader.TokenType; + + Option requiredNotNullableDateProp = default; + Option> requiredNotnullableArrayOfString = default; + Option requiredNotnullableBooleanProp = default; + Option requiredNotnullableDatetimeProp = default; + Option requiredNotnullableEnumInteger = default; + Option requiredNotnullableEnumIntegerOnly = default; + Option requiredNotnullableEnumString = default; + Option requiredNotnullableOuterEnumDefaultValue = default; + Option requiredNotnullableStringProp = default; + Option requiredNotnullableUuid = default; + Option requiredNotnullableintegerProp = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; + Option> requiredNullableArrayOfString = default; + Option requiredNullableBooleanProp = default; + Option requiredNullableDateProp = default; + Option requiredNullableDatetimeProp = default; + Option requiredNullableEnumInteger = default; + Option requiredNullableEnumIntegerOnly = default; + Option requiredNullableEnumString = default; + Option requiredNullableIntegerProp = default; + Option requiredNullableOuterEnumDefaultValue = default; + Option requiredNullableStringProp = default; + Option requiredNullableUuid = default; + Option notRequiredNullableDateProp = default; + Option notRequiredNullableIntegerProp = default; + Option> notrequiredNullableArrayOfString = default; + Option notrequiredNullableBooleanProp = default; + Option notrequiredNullableDatetimeProp = default; + Option notrequiredNullableEnumInteger = default; + Option notrequiredNullableEnumIntegerOnly = default; + Option notrequiredNullableEnumString = default; + Option notrequiredNullableOuterEnumDefaultValue = default; + Option notrequiredNullableStringProp = default; + Option notrequiredNullableUuid = default; + + while (utf8JsonReader.Read()) + { + if (startingTokenType == JsonTokenType.StartObject && utf8JsonReader.TokenType == JsonTokenType.EndObject && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (startingTokenType == JsonTokenType.StartArray && utf8JsonReader.TokenType == JsonTokenType.EndArray && currentDepth == utf8JsonReader.CurrentDepth) + break; + + if (utf8JsonReader.TokenType == JsonTokenType.PropertyName && currentDepth == utf8JsonReader.CurrentDepth - 1) + { + string localVarJsonPropertyName = utf8JsonReader.GetString(); + utf8JsonReader.Read(); + + switch (localVarJsonPropertyName) + { + case "required_not_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "required_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableEnumIntegerOnly = new Option((RequiredClass.RequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_notnullable_enum_string": + string requiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableEnumStringRawValue != null) + requiredNotnullableEnumString = new Option(RequiredClass.RequiredNotnullableEnumStringEnumFromStringOrDefault(requiredNotnullableEnumStringRawValue)); + break; + case "required_notnullable_outerEnumDefaultValue": + string requiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNotnullableOuterEnumDefaultValueRawValue != null) + requiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "required_notnullable_string_prop": + requiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "required_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "required_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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)); + break; + case "required_nullable_enum_integer": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumInteger = new Option((RequiredClass.RequiredNullableEnumIntegerEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableEnumIntegerOnly = new Option((RequiredClass.RequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "required_nullable_enum_string": + string requiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (requiredNullableEnumStringRawValue != null) + requiredNullableEnumString = new Option(RequiredClass.RequiredNullableEnumStringEnumFromStringOrDefault(requiredNullableEnumStringRawValue)); + break; + case "required_nullable_integer_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); + break; + case "required_nullable_outerEnumDefaultValue": + string requiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (requiredNullableOuterEnumDefaultValueRawValue != null) + requiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(requiredNullableOuterEnumDefaultValueRawValue)); + break; + case "required_nullable_string_prop": + requiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "required_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + case "not_required_nullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_nullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_nullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_nullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_nullable_enum_string": + string notrequiredNullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableEnumStringRawValue != null) + notrequiredNullableEnumString = new Option(RequiredClass.NotrequiredNullableEnumStringEnumFromStringOrDefault(notrequiredNullableEnumStringRawValue)); + break; + case "notrequired_nullable_outerEnumDefaultValue": + string notrequiredNullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNullableOuterEnumDefaultValueRawValue != null) + notrequiredNullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_nullable_string_prop": + notrequiredNullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_nullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNullableUuid = new Option(utf8JsonReader.GetGuid()); + break; + default: + break; + } + } + } + + if (!requiredNotNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotNullableDateProp)); + + if (!requiredNotnullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableArrayOfString)); + + if (!requiredNotnullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableBooleanProp)); + + if (!requiredNotnullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableDatetimeProp)); + + if (!requiredNotnullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumInteger)); + + if (!requiredNotnullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumIntegerOnly)); + + if (!requiredNotnullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableEnumString)); + + if (!requiredNotnullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableOuterEnumDefaultValue)); + + if (!requiredNotnullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableStringProp)); + + if (!requiredNotnullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableUuid)); + + if (!requiredNotnullableintegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNotnullableintegerProp)); + + if (!requiredNullableArrayOfString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableArrayOfString)); + + if (!requiredNullableBooleanProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableBooleanProp)); + + if (!requiredNullableDateProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDateProp)); + + if (!requiredNullableDatetimeProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableDatetimeProp)); + + if (!requiredNullableEnumInteger.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumInteger)); + + if (!requiredNullableEnumIntegerOnly.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumIntegerOnly)); + + if (!requiredNullableEnumString.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableEnumString)); + + if (!requiredNullableIntegerProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableIntegerProp)); + + if (!requiredNullableOuterEnumDefaultValue.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableOuterEnumDefaultValue)); + + if (!requiredNullableStringProp.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableStringProp)); + + if (!requiredNullableUuid.IsSet) + throw new ArgumentException("Property is required for class RequiredClass.", nameof(requiredNullableUuid)); + + if (requiredNotNullableDateProp.IsSet && requiredNotNullableDateProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotNullableDateProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableArrayOfString.IsSet && requiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableBooleanProp.IsSet && requiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableDatetimeProp.IsSet && requiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumInteger.IsSet && requiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumIntegerOnly.IsSet && requiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableEnumString.IsSet && requiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableOuterEnumDefaultValue.IsSet && requiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableStringProp.IsSet && requiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableUuid.IsSet && requiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + if (requiredNotnullableintegerProp.IsSet && requiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(requiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableDateProp.IsSet && notRequiredNotnullableDateProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableDateProp), "Property is not nullable for class RequiredClass."); + + if (notRequiredNotnullableintegerProp.IsSet && notRequiredNotnullableintegerProp.Value == null) + throw new ArgumentNullException(nameof(notRequiredNotnullableintegerProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableArrayOfString.IsSet && notrequiredNotnullableArrayOfString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableArrayOfString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableBooleanProp.IsSet && notrequiredNotnullableBooleanProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableBooleanProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableDatetimeProp.IsSet && notrequiredNotnullableDatetimeProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableDatetimeProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumInteger.IsSet && notrequiredNotnullableEnumInteger.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumInteger), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumIntegerOnly.IsSet && notrequiredNotnullableEnumIntegerOnly.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumIntegerOnly), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableEnumString.IsSet && notrequiredNotnullableEnumString.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableEnumString), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableOuterEnumDefaultValue.IsSet && notrequiredNotnullableOuterEnumDefaultValue.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableOuterEnumDefaultValue), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableStringProp.IsSet && notrequiredNotnullableStringProp.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableStringProp), "Property is not nullable for class RequiredClass."); + + if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) + throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); + + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + } + + /// + /// Serializes a + /// + /// + /// + /// + /// + public override void Write(Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + writer.WriteStartObject(); + + WriteProperties(ref writer, requiredClass, jsonSerializerOptions); + writer.WriteEndObject(); + } + + /// + /// Serializes the properties of + /// + /// + /// + /// + /// + public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredClass, JsonSerializerOptions jsonSerializerOptions) + { + if (requiredClass.RequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.RequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.RequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet && requiredClass.NotrequiredNotnullableArrayOfString == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableArrayOfString), "Property is required for class RequiredClass."); + + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) + throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); + + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + + writer.WritePropertyName("required_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + if (requiredNotnullableEnumStringRawValue != null) + writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); + else + writer.WriteNull("required_notnullable_enum_string"); + + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); + + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); // 3 + + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); // 2 + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); // 6 + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); // 6 + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); // 7 + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); // 10 b + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); // 11 + + if (requiredClass.RequiredNullableArrayOfString != null) // 12 + { + writer.WritePropertyName("required_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("required_nullable_array_of_string"); + if (requiredClass.RequiredNullableBooleanProp != null) + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + else + writer.WriteNull("required_nullable_boolean_prop"); + + if (requiredClass.RequiredNullableDateProp != null) + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("required_nullable_date_prop"); + + if (requiredClass.RequiredNullableDatetimeProp != null) + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("required_nullable_datetime_prop"); + + if (requiredClass.RequiredNullableEnumInteger != null) + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer"); + + if (requiredClass.RequiredNullableEnumIntegerOnly != null) + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + else + writer.WriteNull("required_nullable_enum_integer_only"); + + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); // 7 + if (requiredNullableEnumStringRawValue != null) + writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); + else + writer.WriteNull("required_nullable_enum_string"); + + if (requiredClass.RequiredNullableIntegerProp != null) + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + else + writer.WriteNull("required_nullable_integer_prop"); + + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + else + { + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + if (requiredNullableOuterEnumDefaultValueRawValue != null) + writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); + else + writer.WriteNull("required_nullable_outerEnumDefaultValue"); + } + + if (requiredClass.RequiredNullableStringProp != null) + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + else + writer.WriteNull("required_nullable_string_prop"); + + if (requiredClass.RequiredNullableUuid != null) + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + else + writer.WriteNull("required_nullable_uuid"); + + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) + if (requiredClass.NotRequiredNullableDatePropOption.Value != null) + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + else + writer.WriteNull("not_required_nullable_date_prop"); + + if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) + if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); // 3 + else + writer.WriteNull("not_required_nullable_integer_prop"); + + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) + { + writer.WritePropertyName("notrequired_nullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNullableArrayOfString, jsonSerializerOptions); + } + else + writer.WriteNull("notrequired_nullable_array_of_string"); + if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) + if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); // 2 + else + writer.WriteNull("notrequired_nullable_boolean_prop"); + + if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) + if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + else + writer.WriteNull("notrequired_nullable_datetime_prop"); + + if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer"); + + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) + if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); // 6 + else + writer.WriteNull("notrequired_nullable_enum_integer_only"); + + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); // 7 + if (notrequiredNullableEnumStringRawValue != null) + writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); + else + writer.WriteNull("notrequired_nullable_enum_string"); + + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) // 10 a + { + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); // 10 c + writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); + } + else + writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); + if (requiredClass.NotrequiredNullableStringPropOption.IsSet) + if (requiredClass.NotrequiredNullableStringPropOption.Value != null) + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + else + writer.WriteNull("notrequired_nullable_string_prop"); + + if (requiredClass.NotrequiredNullableUuidOption.IsSet) + if (requiredClass.NotrequiredNullableUuidOption.Value != null) + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); // 11 + else + writer.WriteNull("notrequired_nullable_uuid"); + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs index 86e7223ee957..3170fc7d3c1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class Return : IValidatableObject /// /// varReturn [JsonConstructor] - public Return(int varReturn) + public Return(Option varReturn = default) { - VarReturn = varReturn; + VarReturnOption = varReturn; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarReturn + /// + [JsonIgnore] + public Option VarReturnOption { get; private set; } // option d + /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int VarReturn { get; set; } + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver JsonTokenType startingTokenType = utf8JsonReader.TokenType; - int? varReturn = default; + Option varReturn = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver { case "return": if (utf8JsonReader.TokenType != JsonTokenType.Null) - varReturn = utf8JsonReader.GetInt32(); + varReturn = new Option(utf8JsonReader.GetInt32()); break; default: break; @@ -127,10 +134,10 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver } } - if (varReturn == null) - throw new ArgumentNullException(nameof(varReturn), "Property is required for class Return."); + if (varReturn.IsSet && varReturn.Value == null) + throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn.Value); + return new Return(varReturn); // a } /// @@ -157,7 +164,8 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ /// public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("return", varReturn.VarReturn); + if (varReturn.VarReturnOption.IsSet) + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 86effcebe7ae..c219f6f39913 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class RolesReportsHash : IValidatableObject /// role /// roleUuid [JsonConstructor] - public RolesReportsHash(RolesReportsHashRole role, Guid roleUuid) + public RolesReportsHash(Option role = default, Option roleUuid = default) { - Role = role; - RoleUuid = roleUuid; + RoleOption = role; + RoleUuidOption = roleUuid; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Role + /// + [JsonIgnore] + public Option RoleOption { get; private set; } // option d + /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get; set; } + public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new Option(value); } } // d + + /// + /// Used to track the state of RoleUuid + /// + [JsonIgnore] + public Option RoleUuidOption { get; private set; } // option d /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid RoleUuid { get; set; } + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - RolesReportsHashRole role = default; - Guid? roleUuid = default; + Option role = default; + Option roleUuid = default; while (utf8JsonReader.Read()) { @@ -129,11 +142,11 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty { case "role": if (utf8JsonReader.TokenType != JsonTokenType.Null) - role = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + role = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "role_uuid": if (utf8JsonReader.TokenType != JsonTokenType.Null) - roleUuid = utf8JsonReader.GetGuid(); + roleUuid = new Option(utf8JsonReader.GetGuid()); break; default: break; @@ -141,13 +154,13 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (role == null) - throw new ArgumentNullException(nameof(role), "Property is required for class RolesReportsHash."); + if (role.IsSet && role.Value == null) + throw new ArgumentNullException(nameof(role), "Property is not nullable for class RolesReportsHash."); - if (roleUuid == null) - throw new ArgumentNullException(nameof(roleUuid), "Property is required for class RolesReportsHash."); + if (roleUuid.IsSet && roleUuid.Value == null) + throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid.Value); + return new RolesReportsHash(role, roleUuid); // a } /// @@ -174,9 +187,14 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHash rolesReportsH /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesReportsHash, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("role"); - JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); - writer.WriteString("role_uuid", rolesReportsHash.RoleUuid); + if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) + throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); + + if (rolesReportsHash.RoleOption.IsSet) // 14 + writer.WritePropertyName("role"); + JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + if (rolesReportsHash.RoleUuidOption.IsSet) + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index c7002b77b2e1..00a661adfaa4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class RolesReportsHashRole : IValidatableObject /// /// name [JsonConstructor] - public RolesReportsHashRole(string name) + public RolesReportsHashRole(Option name = default) { - Name = name; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d + /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string name = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ switch (localVarJsonPropertyName) { case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ } } - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class RolesReportsHashRole."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); + return new RolesReportsHashRole(name); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, RolesReportsHashRole rolesRepo /// public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole rolesReportsHashRole, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("name", rolesReportsHashRole.Name); + if (rolesReportsHashRole.NameOption.IsSet && rolesReportsHashRole.Name == null) + throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); + + if (rolesReportsHashRole.NameOption.IsSet) + writer.WriteString("name", rolesReportsHashRole.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 4151ead57dfb..7f53a5055a5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; - string triangleType = default; + Option shapeType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ScaleneTriangle."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(shapeType)); - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class ScaleneTriangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class ScaleneTriangle.", nameof(triangleType)); - return new ScaleneTriangle(shapeType, triangleType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ScaleneTriangle."); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); + + return new ScaleneTriangle(shapeType.Value, triangleType.Value); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, ScaleneTriangle scaleneTriangl /// public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTriangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); + if (scaleneTriangle.ShapeType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.ShapeType), "Property is required for class ScaleneTriangle."); + + if (scaleneTriangle.TriangleType == null) + throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); + + writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + + writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs index dae0ef02f966..0f3e3ae6ee76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class Shape."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class Shape.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType); + return new Shape(quadrilateral, shapeType.Value); // c if (triangle != null) - return new Shape(triangle, shapeType); + return new Shape(triangle, shapeType.Value); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, Shape shape, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shape.ShapeType); + if (shape.ShapeType == null) + throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); + + writer.WriteString("shapeType", shape.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index de32fa535aec..9e7193f38251 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeInterface."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeInterface.", nameof(shapeType)); - return new ShapeInterface(shapeType); + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); + + return new ShapeInterface(shapeType.Value); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, ShapeInterface shapeInterface, /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeInterface.ShapeType); + if (shapeInterface.ShapeType == null) + throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); + + writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 955461e12024..3fdfa16615cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -68,7 +69,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -133,7 +134,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string shapeType = default; + Option shapeType = default; Quadrilateral quadrilateral = null; Triangle triangle = null; @@ -184,7 +185,7 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC switch (localVarJsonPropertyName) { case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -192,14 +193,17 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } } - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class ShapeOrNull."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class ShapeOrNull.", nameof(shapeType)); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType); + return new ShapeOrNull(quadrilateral, shapeType.Value); // c if (triangle != null) - return new ShapeOrNull(triangle, shapeType); + return new ShapeOrNull(triangle, shapeType.Value); // c throw new JsonException(); } @@ -238,7 +242,10 @@ public override void Write(Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonS /// public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("shapeType", shapeOrNull.ShapeType); + if (shapeOrNull.ShapeType == null) + throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); + + writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 7f0b8a306f80..0edbb338199b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -47,13 +48,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } + public string QuadrilateralType { get; set; } // d /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } + public string ShapeType { get; set; } // d /// /// Gets or Sets additional properties @@ -109,8 +110,8 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string quadrilateralType = default; - string shapeType = default; + Option quadrilateralType = default; + Option shapeType = default; while (utf8JsonReader.Read()) { @@ -128,10 +129,10 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type switch (localVarJsonPropertyName) { case "quadrilateralType": - quadrilateralType = utf8JsonReader.GetString(); + quadrilateralType = new Option(utf8JsonReader.GetString()); break; case "shapeType": - shapeType = utf8JsonReader.GetString(); + shapeType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -139,13 +140,19 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (quadrilateralType == null) - throw new ArgumentNullException(nameof(quadrilateralType), "Property is required for class SimpleQuadrilateral."); + if (!quadrilateralType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(quadrilateralType)); - if (shapeType == null) - throw new ArgumentNullException(nameof(shapeType), "Property is required for class SimpleQuadrilateral."); + if (!shapeType.IsSet) + throw new ArgumentException("Property is required for class SimpleQuadrilateral.", nameof(shapeType)); - return new SimpleQuadrilateral(quadrilateralType, shapeType); + if (quadrilateralType.IsSet && quadrilateralType.Value == null) + throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class SimpleQuadrilateral."); + + if (shapeType.IsSet && shapeType.Value == null) + throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); + + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); // a } /// @@ -172,8 +179,15 @@ public override void Write(Utf8JsonWriter writer, SimpleQuadrilateral simpleQuad /// public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpleQuadrilateral, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); + if (simpleQuadrilateral.QuadrilateralType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.QuadrilateralType), "Property is required for class SimpleQuadrilateral."); + + if (simpleQuadrilateral.ShapeType == null) + throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); + + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 8328ad3ee121..a74bb807a18c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class SpecialModelName : IValidatableObject /// varSpecialModelName /// specialPropertyName [JsonConstructor] - public SpecialModelName(string varSpecialModelName, long specialPropertyName) + public SpecialModelName(Option varSpecialModelName = default, Option specialPropertyName = default) { - VarSpecialModelName = varSpecialModelName; - SpecialPropertyName = specialPropertyName; + VarSpecialModelNameOption = varSpecialModelName; + SpecialPropertyNameOption = specialPropertyName; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of VarSpecialModelName + /// + [JsonIgnore] + public Option VarSpecialModelNameOption { get; private set; } // option d + /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get; set; } + public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new Option(value); } } // d + + /// + /// Used to track the state of SpecialPropertyName + /// + [JsonIgnore] + public Option SpecialPropertyNameOption { get; private set; } // option d /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long SpecialPropertyName { get; set; } + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string varSpecialModelName = default; - long? specialPropertyName = default; + Option varSpecialModelName = default; + Option specialPropertyName = default; while (utf8JsonReader.Read()) { @@ -128,11 +141,11 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty switch (localVarJsonPropertyName) { case "_special_model.name_": - varSpecialModelName = utf8JsonReader.GetString(); + varSpecialModelName = new Option(utf8JsonReader.GetString()); break; case "$special[property.name]": if (utf8JsonReader.TokenType != JsonTokenType.Null) - specialPropertyName = utf8JsonReader.GetInt64(); + specialPropertyName = new Option(utf8JsonReader.GetInt64()); break; default: break; @@ -140,13 +153,13 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty } } - if (varSpecialModelName == null) - throw new ArgumentNullException(nameof(varSpecialModelName), "Property is required for class SpecialModelName."); + if (varSpecialModelName.IsSet && varSpecialModelName.Value == null) + throw new ArgumentNullException(nameof(varSpecialModelName), "Property is not nullable for class SpecialModelName."); - if (specialPropertyName == null) - throw new ArgumentNullException(nameof(specialPropertyName), "Property is required for class SpecialModelName."); + if (specialPropertyName.IsSet && specialPropertyName.Value == null) + throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName.Value); + return new SpecialModelName(varSpecialModelName, specialPropertyName); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, SpecialModelName specialModelN /// public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialModelName, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyName); + if (specialModelName.VarSpecialModelNameOption.IsSet && specialModelName.VarSpecialModelName == null) + throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); + + if (specialModelName.VarSpecialModelNameOption.IsSet) + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + + if (specialModelName.SpecialPropertyNameOption.IsSet) + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index 6524d75edcf5..51f37f758bf8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,26 +35,38 @@ public partial class Tag : IValidatableObject /// id /// name [JsonConstructor] - public Tag(long id, string name) + public Tag(Option id = default, Option name = default) { - Id = id; - Name = name; + IdOption = id; + NameOption = name; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d + /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + + /// + /// Used to track the state of Name + /// + [JsonIgnore] + public Option NameOption { get; private set; } // option d /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -109,8 +122,8 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - long? id = default; - string name = default; + Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -129,10 +142,10 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, { case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "name": - name = utf8JsonReader.GetString(); + name = new Option(utf8JsonReader.GetString()); break; default: break; @@ -140,13 +153,13 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class Tag."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class Tag."); - if (name == null) - throw new ArgumentNullException(nameof(name), "Property is required for class Tag."); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id.Value, name); + return new Tag(id, name); // a } /// @@ -173,8 +186,14 @@ public override void Write(Utf8JsonWriter writer, Tag tag, JsonSerializerOptions /// public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("id", tag.Id); - writer.WriteString("name", tag.Name); + if (tag.NameOption.IsSet && tag.Name == null) + throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); + + if (tag.IdOption.IsSet) + writer.WriteNumber("id", tag.IdOption.Value.Value); // 3 + + if (tag.NameOption.IsSet) + writer.WriteString("name", tag.Name); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index b2e110e79f67..64a088c088e9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestCollectionEndingWithWordList : IValidatableObject /// /// value [JsonConstructor] - public TestCollectionEndingWithWordList(string value) + public TestCollectionEndingWithWordList(Option value = default) { - Value = value; + ValueOption = value; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Value + /// + [JsonIgnore] + public Option ValueOption { get; private set; } // option d + /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get; set; } + public string Value { get { return this. ValueOption; } set { this.ValueOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string value = default; + Option value = default; while (utf8JsonReader.Read()) { @@ -118,7 +125,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso switch (localVarJsonPropertyName) { case "value": - value = utf8JsonReader.GetString(); + value = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +133,10 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso } } - if (value == null) - throw new ArgumentNullException(nameof(value), "Property is required for class TestCollectionEndingWithWordList."); + if (value.IsSet && value.Value == null) + throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); + return new TestCollectionEndingWithWordList(value); // a } /// @@ -156,7 +163,11 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordList testCollectionEndingWithWordList, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("value", testCollectionEndingWithWordList.Value); + if (testCollectionEndingWithWordList.ValueOption.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); + + if (testCollectionEndingWithWordList.ValueOption.IsSet) + writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 8753edfd9f35..90470deb7933 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestCollectionEndingWithWordListObject : IValidatableObject /// /// testCollectionEndingWithWordList [JsonConstructor] - public TestCollectionEndingWithWordListObject(List testCollectionEndingWithWordList) + public TestCollectionEndingWithWordListObject(Option> testCollectionEndingWithWordList = default) { - TestCollectionEndingWithWordList = testCollectionEndingWithWordList; + TestCollectionEndingWithWordListOption = testCollectionEndingWithWordList; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of TestCollectionEndingWithWordList + /// + [JsonIgnore] + public Option> TestCollectionEndingWithWordListOption { get; private set; } // option d + /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get; set; } + public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new Option>(value); } } // d /// /// Gets or Sets additional properties @@ -100,7 +107,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u JsonTokenType startingTokenType = utf8JsonReader.TokenType; - List testCollectionEndingWithWordList = default; + Option> testCollectionEndingWithWordList = default; while (utf8JsonReader.Read()) { @@ -119,7 +126,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u { case "TestCollectionEndingWithWordList": if (utf8JsonReader.TokenType != JsonTokenType.Null) - testCollectionEndingWithWordList = JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions); + testCollectionEndingWithWordList = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -127,10 +134,10 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u } } - if (testCollectionEndingWithWordList == null) - throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a } /// @@ -157,8 +164,12 @@ public override void Write(Utf8JsonWriter writer, TestCollectionEndingWithWordLi /// public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithWordListObject testCollectionEndingWithWordListObject, JsonSerializerOptions jsonSerializerOptions) { - writer.WritePropertyName("TestCollectionEndingWithWordList"); - JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) + throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); + + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + writer.WritePropertyName("TestCollectionEndingWithWordList"); + JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 139e92b4c6a8..d68ce93a20c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,19 +34,25 @@ public partial class TestInlineFreeformAdditionalPropertiesRequest : Dictionary< /// /// someProperty [JsonConstructor] - public TestInlineFreeformAdditionalPropertiesRequest(string someProperty) : base() + public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty = default) : base() { - SomeProperty = someProperty; + SomePropertyOption = someProperty; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of SomeProperty + /// + [JsonIgnore] + public Option SomePropertyOption { get; private set; } // option d + /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get; set; } + public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -111,7 +118,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string someProperty = default; + Option someProperty = default; while (utf8JsonReader.Read()) { @@ -129,7 +136,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR switch (localVarJsonPropertyName) { case "someProperty": - someProperty = utf8JsonReader.GetString(); + someProperty = new Option(utf8JsonReader.GetString()); break; default: break; @@ -137,10 +144,10 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR } } - if (someProperty == null) - throw new ArgumentNullException(nameof(someProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + if (someProperty.IsSet && someProperty.Value == null) + throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a } /// @@ -167,7 +174,11 @@ public override void Write(Utf8JsonWriter writer, TestInlineFreeformAdditionalPr /// public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditionalPropertiesRequest testInlineFreeformAdditionalPropertiesRequest, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet && testInlineFreeformAdditionalPropertiesRequest.SomeProperty == null) + throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); + + if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs index 814316961f91..ca5cf704e909 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -85,7 +86,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -150,7 +151,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; EquilateralTriangle equilateralTriangle = null; IsoscelesTriangle isoscelesTriangle = null; @@ -207,7 +208,7 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -215,17 +216,20 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class Triangle."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class Triangle.", nameof(triangleType)); + + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType); + return new Triangle(equilateralTriangle, triangleType.Value); // c if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType); + return new Triangle(isoscelesTriangle, triangleType.Value); // c if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType); + return new Triangle(scaleneTriangle, triangleType.Value); // c throw new JsonException(); } @@ -269,7 +273,10 @@ public override void Write(Utf8JsonWriter writer, Triangle triangle, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangle.TriangleType); + if (triangle.TriangleType == null) + throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); + + writer.WriteString("triangleType", triangle.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index 6bd1e4303a70..f21bcd8522f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -45,7 +46,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } + public string TriangleType { get; set; } // d /// /// Gets or Sets additional properties @@ -100,7 +101,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string triangleType = default; + Option triangleType = default; while (utf8JsonReader.Read()) { @@ -118,7 +119,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t switch (localVarJsonPropertyName) { case "triangleType": - triangleType = utf8JsonReader.GetString(); + triangleType = new Option(utf8JsonReader.GetString()); break; default: break; @@ -126,10 +127,13 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t } } - if (triangleType == null) - throw new ArgumentNullException(nameof(triangleType), "Property is required for class TriangleInterface."); + if (!triangleType.IsSet) + throw new ArgumentException("Property is required for class TriangleInterface.", nameof(triangleType)); - return new TriangleInterface(triangleType); + if (triangleType.IsSet && triangleType.Value == null) + throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); + + return new TriangleInterface(triangleType.Value); // a } /// @@ -156,7 +160,10 @@ public override void Write(Utf8JsonWriter writer, TriangleInterface triangleInte /// public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangleInterface, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("triangleType", triangleInterface.TriangleType); + if (triangleInterface.TriangleType == null) + throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); + + writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index ea527b94ec08..ea6bf7956cc2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -44,101 +45,173 @@ public partial class User : IValidatableObject /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(string email, string firstName, long id, string lastName, Object objectWithNoDeclaredProps, string password, string phone, int userStatus, string username, Object anyTypeProp = default, Object anyTypePropNullable = default, Object objectWithNoDeclaredPropsNullable = default) + public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) { - Email = email; - FirstName = firstName; - Id = id; - LastName = lastName; - ObjectWithNoDeclaredProps = objectWithNoDeclaredProps; - Password = password; - Phone = phone; - UserStatus = userStatus; - Username = username; - AnyTypeProp = anyTypeProp; - AnyTypePropNullable = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullable = objectWithNoDeclaredPropsNullable; + EmailOption = email; + FirstNameOption = firstName; + IdOption = id; + LastNameOption = lastName; + ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + PasswordOption = password; + PhoneOption = phone; + UserStatusOption = userStatus; + UsernameOption = username; + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of Email + /// + [JsonIgnore] + public Option EmailOption { get; private set; } // option d + /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get; set; } + public string Email { get { return this. EmailOption; } set { this.EmailOption = new Option(value); } } // d + + /// + /// Used to track the state of FirstName + /// + [JsonIgnore] + public Option FirstNameOption { get; private set; } // option d /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get; set; } + public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new Option(value); } } // d + + /// + /// Used to track the state of Id + /// + [JsonIgnore] + public Option IdOption { get; private set; } // option d /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long Id { get; set; } + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + + /// + /// Used to track the state of LastName + /// + [JsonIgnore] + public Option LastNameOption { get; private set; } // option d /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get; set; } + public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new Option(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredProps + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get; set; } + public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new Option(value); } } // d + + /// + /// Used to track the state of Password + /// + [JsonIgnore] + public Option PasswordOption { get; private set; } // option d /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } + public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new Option(value); } } // d + + /// + /// Used to track the state of Phone + /// + [JsonIgnore] + public Option PhoneOption { get; private set; } // option d /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get; set; } + public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new Option(value); } } // d + + /// + /// Used to track the state of UserStatus + /// + [JsonIgnore] + public Option UserStatusOption { get; private set; } // option d /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int UserStatus { get; set; } + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new Option(value); } } // d + + /// + /// Used to track the state of Username + /// + [JsonIgnore] + public Option UsernameOption { get; private set; } // option d /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get; set; } + public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new Option(value); } } // d + + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + public Option AnyTypePropOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get; set; } + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new Option(value); } } // d + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + public Option AnyTypePropNullableOption { get; private set; } // option d /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get; set; } + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new Option(value); } } // d + + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get; set; } + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -204,18 +277,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string email = default; - string firstName = default; - long? id = default; - string lastName = default; - Object objectWithNoDeclaredProps = default; - string password = default; - string phone = default; - int? userStatus = default; - string username = default; - Object anyTypeProp = default; - Object anyTypePropNullable = default; - Object objectWithNoDeclaredPropsNullable = default; + Option email = default; + Option firstName = default; + Option id = default; + Option lastName = default; + Option objectWithNoDeclaredProps = default; + Option password = default; + Option phone = default; + Option userStatus = default; + Option username = default; + Option anyTypeProp = default; + Option anyTypePropNullable = default; + Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -233,46 +306,46 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, switch (localVarJsonPropertyName) { case "email": - email = utf8JsonReader.GetString(); + email = new Option(utf8JsonReader.GetString()); break; case "firstName": - firstName = utf8JsonReader.GetString(); + firstName = new Option(utf8JsonReader.GetString()); break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) - id = utf8JsonReader.GetInt64(); + id = new Option(utf8JsonReader.GetInt64()); break; case "lastName": - lastName = utf8JsonReader.GetString(); + lastName = new Option(utf8JsonReader.GetString()); break; case "objectWithNoDeclaredProps": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredProps = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "password": - password = utf8JsonReader.GetString(); + password = new Option(utf8JsonReader.GetString()); break; case "phone": - phone = utf8JsonReader.GetString(); + phone = new Option(utf8JsonReader.GetString()); break; case "userStatus": if (utf8JsonReader.TokenType != JsonTokenType.Null) - userStatus = utf8JsonReader.GetInt32(); + userStatus = new Option(utf8JsonReader.GetInt32()); break; case "username": - username = utf8JsonReader.GetString(); + username = new Option(utf8JsonReader.GetString()); break; case "anyTypeProp": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "anyTypePropNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; case "objectWithNoDeclaredPropsNullable": if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions); + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; default: break; @@ -280,34 +353,34 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, } } - if (email == null) - throw new ArgumentNullException(nameof(email), "Property is required for class User."); + if (email.IsSet && email.Value == null) + throw new ArgumentNullException(nameof(email), "Property is not nullable for class User."); - if (firstName == null) - throw new ArgumentNullException(nameof(firstName), "Property is required for class User."); + if (firstName.IsSet && firstName.Value == null) + throw new ArgumentNullException(nameof(firstName), "Property is not nullable for class User."); - if (id == null) - throw new ArgumentNullException(nameof(id), "Property is required for class User."); + if (id.IsSet && id.Value == null) + throw new ArgumentNullException(nameof(id), "Property is not nullable for class User."); - if (lastName == null) - throw new ArgumentNullException(nameof(lastName), "Property is required for class User."); + if (lastName.IsSet && lastName.Value == null) + throw new ArgumentNullException(nameof(lastName), "Property is not nullable for class User."); - if (objectWithNoDeclaredProps == null) - throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is required for class User."); + if (objectWithNoDeclaredProps.IsSet && objectWithNoDeclaredProps.Value == null) + throw new ArgumentNullException(nameof(objectWithNoDeclaredProps), "Property is not nullable for class User."); - if (password == null) - throw new ArgumentNullException(nameof(password), "Property is required for class User."); + if (password.IsSet && password.Value == null) + throw new ArgumentNullException(nameof(password), "Property is not nullable for class User."); - if (phone == null) - throw new ArgumentNullException(nameof(phone), "Property is required for class User."); + if (phone.IsSet && phone.Value == null) + throw new ArgumentNullException(nameof(phone), "Property is not nullable for class User."); - if (userStatus == null) - throw new ArgumentNullException(nameof(userStatus), "Property is required for class User."); + if (userStatus.IsSet && userStatus.Value == null) + throw new ArgumentNullException(nameof(userStatus), "Property is not nullable for class User."); - if (username == null) - throw new ArgumentNullException(nameof(username), "Property is required for class User."); + if (username.IsSet && username.Value == null) + throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id.Value, lastName, objectWithNoDeclaredProps, password, phone, userStatus.Value, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a } /// @@ -334,22 +407,78 @@ public override void Write(Utf8JsonWriter writer, User user, JsonSerializerOptio /// public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("email", user.Email); - writer.WriteString("firstName", user.FirstName); - writer.WriteNumber("id", user.Id); - writer.WriteString("lastName", user.LastName); - writer.WritePropertyName("objectWithNoDeclaredProps"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); - writer.WriteString("password", user.Password); - writer.WriteString("phone", user.Phone); - writer.WriteNumber("userStatus", user.UserStatus); - writer.WriteString("username", user.Username); - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + if (user.EmailOption.IsSet && user.Email == null) + throw new ArgumentNullException(nameof(user.Email), "Property is required for class User."); + + if (user.FirstNameOption.IsSet && user.FirstName == null) + throw new ArgumentNullException(nameof(user.FirstName), "Property is required for class User."); + + if (user.LastNameOption.IsSet && user.LastName == null) + throw new ArgumentNullException(nameof(user.LastName), "Property is required for class User."); + + if (user.ObjectWithNoDeclaredPropsOption.IsSet && user.ObjectWithNoDeclaredProps == null) + throw new ArgumentNullException(nameof(user.ObjectWithNoDeclaredProps), "Property is required for class User."); + + if (user.PasswordOption.IsSet && user.Password == null) + throw new ArgumentNullException(nameof(user.Password), "Property is required for class User."); + + if (user.PhoneOption.IsSet && user.Phone == null) + throw new ArgumentNullException(nameof(user.Phone), "Property is required for class User."); + + if (user.UsernameOption.IsSet && user.Username == null) + throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + + if (user.EmailOption.IsSet) + writer.WriteString("email", user.Email); // 1 + + if (user.FirstNameOption.IsSet) + writer.WriteString("firstName", user.FirstName); // 1 + + if (user.IdOption.IsSet) + writer.WriteNumber("id", user.IdOption.Value.Value); // 3 + + if (user.LastNameOption.IsSet) + writer.WriteString("lastName", user.LastName); // 1 + + if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + writer.WritePropertyName("objectWithNoDeclaredProps"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + if (user.PasswordOption.IsSet) + writer.WriteString("password", user.Password); // 1 + + if (user.PhoneOption.IsSet) + writer.WriteString("phone", user.Phone); // 1 + + if (user.UserStatusOption.IsSet) + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); // 3 + + if (user.UsernameOption.IsSet) + writer.WriteString("username", user.Username); // 1 + + if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index e633a5c92cf5..37608caae3cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -35,11 +36,11 @@ public partial class Whale : IValidatableObject /// hasBaleen /// hasTeeth [JsonConstructor] - public Whale(string className, bool hasBaleen, bool hasTeeth) + public Whale(string className, Option hasBaleen = default, Option hasTeeth = default) { ClassName = className; - HasBaleen = hasBaleen; - HasTeeth = hasTeeth; + HasBaleenOption = hasBaleen; + HasTeethOption = hasTeeth; OnCreated(); } @@ -49,19 +50,31 @@ public Whale(string className, bool hasBaleen, bool hasTeeth) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d + + /// + /// Used to track the state of HasBaleen + /// + [JsonIgnore] + public Option HasBaleenOption { get; private set; } // option d /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool HasBaleen { get; set; } + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new Option(value); } } // d + + /// + /// Used to track the state of HasTeeth + /// + [JsonIgnore] + public Option HasTeethOption { get; private set; } // option d /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool HasTeeth { get; set; } + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new Option(value); } } // d /// /// Gets or Sets additional properties @@ -118,9 +131,9 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - bool? hasBaleen = default; - bool? hasTeeth = default; + Option className = default; + Option hasBaleen = default; + Option hasTeeth = default; while (utf8JsonReader.Read()) { @@ -138,15 +151,15 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "hasBaleen": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasBaleen = utf8JsonReader.GetBoolean(); + hasBaleen = new Option(utf8JsonReader.GetBoolean()); break; case "hasTeeth": if (utf8JsonReader.TokenType != JsonTokenType.Null) - hasTeeth = utf8JsonReader.GetBoolean(); + hasTeeth = new Option(utf8JsonReader.GetBoolean()); break; default: break; @@ -154,16 +167,19 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Whale."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Whale.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Whale."); - if (hasBaleen == null) - throw new ArgumentNullException(nameof(hasBaleen), "Property is required for class Whale."); + if (hasBaleen.IsSet && hasBaleen.Value == null) + throw new ArgumentNullException(nameof(hasBaleen), "Property is not nullable for class Whale."); - if (hasTeeth == null) - throw new ArgumentNullException(nameof(hasTeeth), "Property is required for class Whale."); + if (hasTeeth.IsSet && hasTeeth.Value == null) + throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className, hasBaleen.Value, hasTeeth.Value); + return new Whale(className.Value, hasBaleen, hasTeeth); // a } /// @@ -190,9 +206,16 @@ public override void Write(Utf8JsonWriter writer, Whale whale, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", whale.ClassName); - writer.WriteBoolean("hasBaleen", whale.HasBaleen); - writer.WriteBoolean("hasTeeth", whale.HasTeeth); + if (whale.ClassName == null) + throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); + + writer.WriteString("className", whale.ClassName); // 1 + + if (whale.HasBaleenOption.IsSet) + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); // 2 + + if (whale.HasTeethOption.IsSet) + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 52135d8a3c51..896c3ba6f7d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -34,10 +35,10 @@ public partial class Zebra : Dictionary, IValidatableObject /// className /// type [JsonConstructor] - public Zebra(string className, TypeEnum type) : base() + public Zebra(string className, Option type = default) : base() { ClassName = className; - Type = type; + TypeOption = type; OnCreated(); } @@ -109,9 +110,8 @@ public static TypeEnum TypeEnumFromString(string value) /// /// /// - public static string TypeEnumToJsonValue(TypeEnum value) + public static string TypeEnumToJsonValue(TypeEnum? value) { - if (value == TypeEnum.Plains) return "plains"; @@ -124,17 +124,23 @@ public static string TypeEnumToJsonValue(TypeEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of Type + /// + [JsonIgnore] + public Option TypeOption { get; private set; } // option a + /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum Type { get; set; } + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new Option(value); } } // a /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } + public string ClassName { get; set; } // d /// /// Gets or Sets additional properties @@ -201,8 +207,8 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; - string className = default; - Zebra.TypeEnum? type = default; + Option className = default; + Option type = default; while (utf8JsonReader.Read()) { @@ -220,13 +226,12 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { case "className": - className = utf8JsonReader.GetString(); + className = new Option(utf8JsonReader.GetString()); break; case "type": string typeRawValue = utf8JsonReader.GetString(); - type = typeRawValue == null - ? null - : Zebra.TypeEnumFromStringOrDefault(typeRawValue); + if (typeRawValue != null) + type = new Option(Zebra.TypeEnumFromStringOrDefault(typeRawValue)); break; default: break; @@ -234,13 +239,16 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert } } - if (className == null) - throw new ArgumentNullException(nameof(className), "Property is required for class Zebra."); + if (!className.IsSet) + throw new ArgumentException("Property is required for class Zebra.", nameof(className)); + + if (className.IsSet && className.Value == null) + throw new ArgumentNullException(nameof(className), "Property is not nullable for class Zebra."); - if (type == null) - throw new ArgumentNullException(nameof(type), "Property is required for class Zebra."); + if (type.IsSet && type.Value == null) + throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className, type.Value); + return new Zebra(className.Value, type); // a } /// @@ -267,9 +275,12 @@ public override void Write(Utf8JsonWriter writer, Zebra zebra, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteString("className", zebra.ClassName); + if (zebra.ClassName == null) + throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); + + writer.WriteString("className", zebra.ClassName); // 1 - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.Type); + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); // 7 if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs index 20e184f02b2b..34a044fb8b13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnum.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 7e5f3cdafcca..628624c9aa3f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -20,6 +20,7 @@ using System.Text.Json.Serialization; using System.ComponentModel.DataAnnotations; using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; +using Org.OpenAPITools.Client; namespace Org.OpenAPITools.Model { @@ -33,9 +34,9 @@ public partial class ZeroBasedEnumClass : IValidatableObject /// /// zeroBasedEnum [JsonConstructor] - public ZeroBasedEnumClass(ZeroBasedEnumEnum zeroBasedEnum) + public ZeroBasedEnumClass(Option zeroBasedEnum = default) { - ZeroBasedEnum = zeroBasedEnum; + ZeroBasedEnumOption = zeroBasedEnum; OnCreated(); } @@ -96,9 +97,8 @@ public static ZeroBasedEnumEnum ZeroBasedEnumEnumFromString(string value) /// /// /// - public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) + public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) { - if (value == ZeroBasedEnumEnum.Unknown) return "unknown"; @@ -108,11 +108,17 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum value) throw new NotImplementedException($"Value could not be handled: '{value}'"); } + /// + /// Used to track the state of ZeroBasedEnum + /// + [JsonIgnore] + public Option ZeroBasedEnumOption { get; private set; } // option a + /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum ZeroBasedEnum { get; set; } + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new Option(value); } } // a /// /// Gets or Sets additional properties @@ -167,7 +173,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type JsonTokenType startingTokenType = utf8JsonReader.TokenType; - ZeroBasedEnumClass.ZeroBasedEnumEnum? zeroBasedEnum = default; + Option zeroBasedEnum = default; while (utf8JsonReader.Read()) { @@ -186,9 +192,8 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type { case "ZeroBasedEnum": string zeroBasedEnumRawValue = utf8JsonReader.GetString(); - zeroBasedEnum = zeroBasedEnumRawValue == null - ? null - : ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue); + if (zeroBasedEnumRawValue != null) + zeroBasedEnum = new Option(ZeroBasedEnumClass.ZeroBasedEnumEnumFromStringOrDefault(zeroBasedEnumRawValue)); break; default: break; @@ -196,10 +201,10 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type } } - if (zeroBasedEnum == null) - throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is required for class ZeroBasedEnumClass."); + if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) + throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum.Value); + return new ZeroBasedEnumClass(zeroBasedEnum); // a } /// @@ -226,8 +231,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnum); + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); // 7 if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES index cfa6edb1db83..3079e1bed81a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -195,6 +196,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md index 18aa6dd26bc4..45508dddfc61 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/README.md @@ -246,6 +246,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index 2728aa9a25af..63b142690676 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -155,28 +155,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index 0bd9d03d007a..f95bce90aae6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -433,10 +433,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -454,28 +461,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 7aae060d7a45..b1011f770a1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -168,10 +168,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..919ae3fc0fe8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1043 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using FileParameter = Org.OpenAPITools.Client.FileParameter; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs index 5ff006145c2f..1df6354dc026 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs @@ -154,28 +154,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs index 8a1f7d62fa27..43473b1efea3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,10 +432,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -453,28 +460,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index ec3e8e7b68c4..5bf84c73a24b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,10 +167,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs index 5ff006145c2f..1df6354dc026 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs @@ -154,28 +154,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs index 8a1f7d62fa27..43473b1efea3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,10 +432,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -453,28 +460,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index ec3e8e7b68c4..5bf84c73a24b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,10 +167,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES index ddeca89d213f..1e54de3472d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -198,6 +199,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs index 5ff006145c2f..1df6354dc026 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs @@ -154,28 +154,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs index 8a1f7d62fa27..43473b1efea3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,10 +432,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -453,28 +460,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index ec3e8e7b68c4..5bf84c73a24b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,10 +167,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES index b6dffff4f19f..b73f11d50f17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/.openapi-generator/FILES @@ -75,6 +75,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -194,6 +195,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md index dcfb29678186..7397b3f98161 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/README.md @@ -207,6 +207,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](Quadrilateral.md) - [Model.QuadrilateralInterface](QuadrilateralInterface.md) - [Model.ReadOnlyFirst](ReadOnlyFirst.md) + - [Model.RequiredClass](RequiredClass.md) - [Model.Return](Return.md) - [Model.RolesReportsHash](RolesReportsHash.md) - [Model.RolesReportsHashRole](RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..24f5e2325d28 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,410 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; +using NUnit.Framework; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Test] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Test] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Test] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Test] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Test] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Test] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Test] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Test] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Test] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Test] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Test] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Test] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Test] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Test] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Test] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Test] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Test] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Test] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Test] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Test] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Test] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Test] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Test] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Test] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Test] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Test] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Test] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Test] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Test] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Test] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Test] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Test] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Test] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Test] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Test] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Test] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Test] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + /// + /// Test the property 'RequiredNullableUuid' + /// + [Test] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Test] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Test] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Test] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Test] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Test] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Test] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Test] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..eb89d56999fc --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient-unityWebRequest/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1224 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() { } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as RequiredClass); + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + if (input == null) + { + return false; + } + return + ( + this.RequiredNullableIntegerProp == input.RequiredNullableIntegerProp || + (this.RequiredNullableIntegerProp != null && + this.RequiredNullableIntegerProp.Equals(input.RequiredNullableIntegerProp)) + ) && + ( + this.RequiredNotnullableintegerProp == input.RequiredNotnullableintegerProp || + this.RequiredNotnullableintegerProp.Equals(input.RequiredNotnullableintegerProp) + ) && + ( + this.NotRequiredNullableIntegerProp == input.NotRequiredNullableIntegerProp || + (this.NotRequiredNullableIntegerProp != null && + this.NotRequiredNullableIntegerProp.Equals(input.NotRequiredNullableIntegerProp)) + ) && + ( + this.NotRequiredNotnullableintegerProp == input.NotRequiredNotnullableintegerProp || + this.NotRequiredNotnullableintegerProp.Equals(input.NotRequiredNotnullableintegerProp) + ) && + ( + this.RequiredNullableStringProp == input.RequiredNullableStringProp || + (this.RequiredNullableStringProp != null && + this.RequiredNullableStringProp.Equals(input.RequiredNullableStringProp)) + ) && + ( + this.RequiredNotnullableStringProp == input.RequiredNotnullableStringProp || + (this.RequiredNotnullableStringProp != null && + this.RequiredNotnullableStringProp.Equals(input.RequiredNotnullableStringProp)) + ) && + ( + this.NotrequiredNullableStringProp == input.NotrequiredNullableStringProp || + (this.NotrequiredNullableStringProp != null && + this.NotrequiredNullableStringProp.Equals(input.NotrequiredNullableStringProp)) + ) && + ( + this.NotrequiredNotnullableStringProp == input.NotrequiredNotnullableStringProp || + (this.NotrequiredNotnullableStringProp != null && + this.NotrequiredNotnullableStringProp.Equals(input.NotrequiredNotnullableStringProp)) + ) && + ( + this.RequiredNullableBooleanProp == input.RequiredNullableBooleanProp || + (this.RequiredNullableBooleanProp != null && + this.RequiredNullableBooleanProp.Equals(input.RequiredNullableBooleanProp)) + ) && + ( + this.RequiredNotnullableBooleanProp == input.RequiredNotnullableBooleanProp || + this.RequiredNotnullableBooleanProp.Equals(input.RequiredNotnullableBooleanProp) + ) && + ( + this.NotrequiredNullableBooleanProp == input.NotrequiredNullableBooleanProp || + (this.NotrequiredNullableBooleanProp != null && + this.NotrequiredNullableBooleanProp.Equals(input.NotrequiredNullableBooleanProp)) + ) && + ( + this.NotrequiredNotnullableBooleanProp == input.NotrequiredNotnullableBooleanProp || + this.NotrequiredNotnullableBooleanProp.Equals(input.NotrequiredNotnullableBooleanProp) + ) && + ( + this.RequiredNullableDateProp == input.RequiredNullableDateProp || + (this.RequiredNullableDateProp != null && + this.RequiredNullableDateProp.Equals(input.RequiredNullableDateProp)) + ) && + ( + this.RequiredNotNullableDateProp == input.RequiredNotNullableDateProp || + (this.RequiredNotNullableDateProp != null && + this.RequiredNotNullableDateProp.Equals(input.RequiredNotNullableDateProp)) + ) && + ( + this.NotRequiredNullableDateProp == input.NotRequiredNullableDateProp || + (this.NotRequiredNullableDateProp != null && + this.NotRequiredNullableDateProp.Equals(input.NotRequiredNullableDateProp)) + ) && + ( + this.NotRequiredNotnullableDateProp == input.NotRequiredNotnullableDateProp || + (this.NotRequiredNotnullableDateProp != null && + this.NotRequiredNotnullableDateProp.Equals(input.NotRequiredNotnullableDateProp)) + ) && + ( + this.RequiredNotnullableDatetimeProp == input.RequiredNotnullableDatetimeProp || + (this.RequiredNotnullableDatetimeProp != null && + this.RequiredNotnullableDatetimeProp.Equals(input.RequiredNotnullableDatetimeProp)) + ) && + ( + this.RequiredNullableDatetimeProp == input.RequiredNullableDatetimeProp || + (this.RequiredNullableDatetimeProp != null && + this.RequiredNullableDatetimeProp.Equals(input.RequiredNullableDatetimeProp)) + ) && + ( + this.NotrequiredNullableDatetimeProp == input.NotrequiredNullableDatetimeProp || + (this.NotrequiredNullableDatetimeProp != null && + this.NotrequiredNullableDatetimeProp.Equals(input.NotrequiredNullableDatetimeProp)) + ) && + ( + this.NotrequiredNotnullableDatetimeProp == input.NotrequiredNotnullableDatetimeProp || + (this.NotrequiredNotnullableDatetimeProp != null && + this.NotrequiredNotnullableDatetimeProp.Equals(input.NotrequiredNotnullableDatetimeProp)) + ) && + ( + this.RequiredNullableEnumInteger == input.RequiredNullableEnumInteger || + this.RequiredNullableEnumInteger.Equals(input.RequiredNullableEnumInteger) + ) && + ( + this.RequiredNotnullableEnumInteger == input.RequiredNotnullableEnumInteger || + this.RequiredNotnullableEnumInteger.Equals(input.RequiredNotnullableEnumInteger) + ) && + ( + this.NotrequiredNullableEnumInteger == input.NotrequiredNullableEnumInteger || + this.NotrequiredNullableEnumInteger.Equals(input.NotrequiredNullableEnumInteger) + ) && + ( + this.NotrequiredNotnullableEnumInteger == input.NotrequiredNotnullableEnumInteger || + this.NotrequiredNotnullableEnumInteger.Equals(input.NotrequiredNotnullableEnumInteger) + ) && + ( + this.RequiredNullableEnumIntegerOnly == input.RequiredNullableEnumIntegerOnly || + this.RequiredNullableEnumIntegerOnly.Equals(input.RequiredNullableEnumIntegerOnly) + ) && + ( + this.RequiredNotnullableEnumIntegerOnly == input.RequiredNotnullableEnumIntegerOnly || + this.RequiredNotnullableEnumIntegerOnly.Equals(input.RequiredNotnullableEnumIntegerOnly) + ) && + ( + this.NotrequiredNullableEnumIntegerOnly == input.NotrequiredNullableEnumIntegerOnly || + this.NotrequiredNullableEnumIntegerOnly.Equals(input.NotrequiredNullableEnumIntegerOnly) + ) && + ( + this.NotrequiredNotnullableEnumIntegerOnly == input.NotrequiredNotnullableEnumIntegerOnly || + this.NotrequiredNotnullableEnumIntegerOnly.Equals(input.NotrequiredNotnullableEnumIntegerOnly) + ) && + ( + this.RequiredNotnullableEnumString == input.RequiredNotnullableEnumString || + this.RequiredNotnullableEnumString.Equals(input.RequiredNotnullableEnumString) + ) && + ( + this.RequiredNullableEnumString == input.RequiredNullableEnumString || + this.RequiredNullableEnumString.Equals(input.RequiredNullableEnumString) + ) && + ( + this.NotrequiredNullableEnumString == input.NotrequiredNullableEnumString || + this.NotrequiredNullableEnumString.Equals(input.NotrequiredNullableEnumString) + ) && + ( + this.NotrequiredNotnullableEnumString == input.NotrequiredNotnullableEnumString || + this.NotrequiredNotnullableEnumString.Equals(input.NotrequiredNotnullableEnumString) + ) && + ( + this.RequiredNullableOuterEnumDefaultValue == input.RequiredNullableOuterEnumDefaultValue || + this.RequiredNullableOuterEnumDefaultValue.Equals(input.RequiredNullableOuterEnumDefaultValue) + ) && + ( + this.RequiredNotnullableOuterEnumDefaultValue == input.RequiredNotnullableOuterEnumDefaultValue || + this.RequiredNotnullableOuterEnumDefaultValue.Equals(input.RequiredNotnullableOuterEnumDefaultValue) + ) && + ( + this.NotrequiredNullableOuterEnumDefaultValue == input.NotrequiredNullableOuterEnumDefaultValue || + this.NotrequiredNullableOuterEnumDefaultValue.Equals(input.NotrequiredNullableOuterEnumDefaultValue) + ) && + ( + this.NotrequiredNotnullableOuterEnumDefaultValue == input.NotrequiredNotnullableOuterEnumDefaultValue || + this.NotrequiredNotnullableOuterEnumDefaultValue.Equals(input.NotrequiredNotnullableOuterEnumDefaultValue) + ) && + ( + this.RequiredNullableUuid == input.RequiredNullableUuid || + (this.RequiredNullableUuid != null && + this.RequiredNullableUuid.Equals(input.RequiredNullableUuid)) + ) && + ( + this.RequiredNotnullableUuid == input.RequiredNotnullableUuid || + (this.RequiredNotnullableUuid != null && + this.RequiredNotnullableUuid.Equals(input.RequiredNotnullableUuid)) + ) && + ( + this.NotrequiredNullableUuid == input.NotrequiredNullableUuid || + (this.NotrequiredNullableUuid != null && + this.NotrequiredNullableUuid.Equals(input.NotrequiredNullableUuid)) + ) && + ( + this.NotrequiredNotnullableUuid == input.NotrequiredNotnullableUuid || + (this.NotrequiredNotnullableUuid != null && + this.NotrequiredNotnullableUuid.Equals(input.NotrequiredNotnullableUuid)) + ) && + ( + this.RequiredNullableArrayOfString == input.RequiredNullableArrayOfString || + this.RequiredNullableArrayOfString != null && + input.RequiredNullableArrayOfString != null && + this.RequiredNullableArrayOfString.SequenceEqual(input.RequiredNullableArrayOfString) + ) && + ( + this.RequiredNotnullableArrayOfString == input.RequiredNotnullableArrayOfString || + this.RequiredNotnullableArrayOfString != null && + input.RequiredNotnullableArrayOfString != null && + this.RequiredNotnullableArrayOfString.SequenceEqual(input.RequiredNotnullableArrayOfString) + ) && + ( + this.NotrequiredNullableArrayOfString == input.NotrequiredNullableArrayOfString || + this.NotrequiredNullableArrayOfString != null && + input.NotrequiredNullableArrayOfString != null && + this.NotrequiredNullableArrayOfString.SequenceEqual(input.NotrequiredNullableArrayOfString) + ) && + ( + this.NotrequiredNotnullableArrayOfString == input.NotrequiredNotnullableArrayOfString || + this.NotrequiredNotnullableArrayOfString != null && + input.NotrequiredNotnullableArrayOfString != null && + this.NotrequiredNotnullableArrayOfString.SequenceEqual(input.NotrequiredNotnullableArrayOfString) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES index f69e6ba1aba7..0af518f942ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClient/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -197,6 +198,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index af827f28641e..c2d5ddeb3539 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -221,6 +221,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClient/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs index 5ff006145c2f..1df6354dc026 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs @@ -154,28 +154,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index 8a1f7d62fa27..43473b1efea3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,10 +432,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -453,28 +460,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index ec3e8e7b68c4..5bf84c73a24b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,10 +167,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..90e0c44b40b8 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1042 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() + { + this.AdditionalProperties = new Dictionary(); + } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + this.AdditionalProperties = new Dictionary(); + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.AdditionalProperties != null) + { + hashCode = (hashCode * 59) + this.AdditionalProperties.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES index f69e6ba1aba7..0af518f942ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/OpenAPIClientCore/.openapi-generator/FILES @@ -77,6 +77,7 @@ docs/PolymorphicProperty.md docs/Quadrilateral.md docs/QuadrilateralInterface.md docs/ReadOnlyFirst.md +docs/RequiredClass.md docs/Return.md docs/RolesReportsHash.md docs/RolesReportsHashRole.md @@ -197,6 +198,7 @@ src/Org.OpenAPITools/Model/PolymorphicProperty.cs src/Org.OpenAPITools/Model/Quadrilateral.cs src/Org.OpenAPITools/Model/QuadrilateralInterface.cs src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +src/Org.OpenAPITools/Model/RequiredClass.cs src/Org.OpenAPITools/Model/Return.cs src/Org.OpenAPITools/Model/RolesReportsHash.cs src/Org.OpenAPITools/Model/RolesReportsHashRole.cs diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/README.md b/samples/client/petstore/csharp/OpenAPIClientCore/README.md index 2a3e242fe88d..b344c43c38b5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientCore/README.md @@ -233,6 +233,7 @@ Class | Method | HTTP request | Description - [Model.Quadrilateral](docs/Quadrilateral.md) - [Model.QuadrilateralInterface](docs/QuadrilateralInterface.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) + - [Model.RequiredClass](docs/RequiredClass.md) - [Model.Return](docs/Return.md) - [Model.RolesReportsHash](docs/RolesReportsHash.md) - [Model.RolesReportsHashRole](docs/RolesReportsHashRole.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml index f6eeaf555f13..70e89968fbe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml +++ b/samples/client/petstore/csharp/OpenAPIClientCore/api/openapi.yaml @@ -1946,6 +1946,264 @@ components: nullable: true type: string type: object + RequiredClass: + properties: + required_nullable_integer_prop: + nullable: true + type: integer + required_notnullableinteger_prop: + nullable: false + type: integer + not_required_nullable_integer_prop: + nullable: true + type: integer + not_required_notnullableinteger_prop: + nullable: false + type: integer + required_nullable_string_prop: + nullable: true + type: string + required_notnullable_string_prop: + nullable: false + type: string + notrequired_nullable_string_prop: + nullable: true + type: string + notrequired_notnullable_string_prop: + nullable: false + type: string + required_nullable_boolean_prop: + nullable: true + type: boolean + required_notnullable_boolean_prop: + nullable: false + type: boolean + notrequired_nullable_boolean_prop: + nullable: true + type: boolean + notrequired_notnullable_boolean_prop: + nullable: false + type: boolean + required_nullable_date_prop: + format: date + nullable: true + type: string + required_not_nullable_date_prop: + format: date + nullable: false + type: string + not_required_nullable_date_prop: + format: date + nullable: true + type: string + not_required_notnullable_date_prop: + format: date + nullable: false + type: string + required_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_nullable_datetime_prop: + format: date-time + nullable: true + type: string + notrequired_notnullable_datetime_prop: + format: date-time + nullable: false + type: string + required_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + required_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + notrequired_nullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: true + type: integer + notrequired_notnullable_enum_integer: + enum: + - 1 + - -1 + format: int32 + nullable: false + type: integer + required_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + required_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + notrequired_nullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: true + type: integer + notrequired_notnullable_enum_integer_only: + enum: + - 2 + - -2 + nullable: false + type: integer + required_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_nullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: true + type: string + notrequired_notnullable_enum_string: + enum: + - UPPER + - lower + - "" + - "Value\twith tab" + - Value with " quote + - Value with escaped \" quote + - |- + Duplicate + value + - "Duplicate\r\nvalue" + nullable: false + type: string + required_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + required_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + notrequired_nullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: true + notrequired_notnullable_outerEnumDefaultValue: + allOf: + - $ref: '#/components/schemas/OuterEnumDefaultValue' + nullable: false + required_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + required_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + notrequired_nullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: true + type: string + notrequired_notnullable_uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + nullable: false + type: string + required_nullable_array_of_string: + items: + type: string + nullable: true + type: array + required_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + notrequired_nullable_array_of_string: + items: + type: string + nullable: true + type: array + notrequired_notnullable_array_of_string: + items: + type: string + nullable: false + type: array + required: + - required_not_nullable_date_prop + - required_notnullable_array_of_string + - required_notnullable_boolean_prop + - required_notnullable_datetime_prop + - required_notnullable_enum_integer + - required_notnullable_enum_integer_only + - required_notnullable_enum_string + - required_notnullable_outerEnumDefaultValue + - required_notnullable_string_prop + - required_notnullable_uuid + - required_notnullableinteger_prop + - required_nullable_array_of_string + - required_nullable_boolean_prop + - required_nullable_date_prop + - required_nullable_datetime_prop + - required_nullable_enum_integer + - required_nullable_enum_integer_only + - required_nullable_enum_string + - required_nullable_integer_prop + - required_nullable_outerEnumDefaultValue + - required_nullable_string_prop + - required_nullable_uuid + type: object NullableClass: additionalProperties: nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md new file mode 100644 index 000000000000..07b6f018f6c1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/docs/RequiredClass.md @@ -0,0 +1,53 @@ +# Org.OpenAPITools.Model.RequiredClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**RequiredNullableIntegerProp** | **int?** | | +**RequiredNotnullableintegerProp** | **int** | | +**NotRequiredNullableIntegerProp** | **int?** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] +**RequiredNullableStringProp** | **string** | | +**RequiredNotnullableStringProp** | **string** | | +**NotrequiredNullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**RequiredNullableBooleanProp** | **bool?** | | +**RequiredNotnullableBooleanProp** | **bool** | | +**NotrequiredNullableBooleanProp** | **bool?** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**RequiredNullableDateProp** | **DateTime?** | | +**RequiredNotNullableDateProp** | **DateTime** | | +**NotRequiredNullableDateProp** | **DateTime?** | | [optional] +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**RequiredNotnullableDatetimeProp** | **DateTime** | | +**RequiredNullableDatetimeProp** | **DateTime?** | | +**NotrequiredNullableDatetimeProp** | **DateTime?** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**RequiredNullableEnumInteger** | **int?** | | +**RequiredNotnullableEnumInteger** | **int** | | +**NotrequiredNullableEnumInteger** | **int?** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**RequiredNullableEnumIntegerOnly** | **int?** | | +**RequiredNotnullableEnumIntegerOnly** | **int** | | +**NotrequiredNullableEnumIntegerOnly** | **int?** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**RequiredNotnullableEnumString** | **string** | | +**RequiredNullableEnumString** | **string** | | +**NotrequiredNullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**RequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | +**NotrequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**RequiredNullableUuid** | **Guid?** | | +**RequiredNotnullableUuid** | **Guid** | | +**NotrequiredNullableUuid** | **Guid?** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] +**RequiredNullableArrayOfString** | **List<string>** | | +**RequiredNotnullableArrayOfString** | **List<string>** | | +**NotrequiredNullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs new file mode 100644 index 000000000000..17de04feade0 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools.Test/Model/RequiredClassTests.cs @@ -0,0 +1,453 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using Xunit; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test.Model +{ + /// + /// Class for testing RequiredClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + public class RequiredClassTests : IDisposable + { + // TODO uncomment below to declare an instance variable for RequiredClass + //private RequiredClass instance; + + public RequiredClassTests() + { + // TODO uncomment below to create an instance of RequiredClass + //instance = new RequiredClass(); + } + + public void Dispose() + { + // Cleanup when everything is done. + } + + /// + /// Test an instance of RequiredClass + /// + [Fact] + public void RequiredClassInstanceTest() + { + // TODO uncomment below to test "IsType" RequiredClass + //Assert.IsType(instance); + } + + /// + /// Test the property 'RequiredNullableIntegerProp' + /// + [Fact] + public void RequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'RequiredNullableIntegerProp' + } + + /// + /// Test the property 'RequiredNotnullableintegerProp' + /// + [Fact] + public void RequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'RequiredNotnullableintegerProp' + } + + /// + /// Test the property 'NotRequiredNullableIntegerProp' + /// + [Fact] + public void NotRequiredNullableIntegerPropTest() + { + // TODO unit test for the property 'NotRequiredNullableIntegerProp' + } + + /// + /// Test the property 'NotRequiredNotnullableintegerProp' + /// + [Fact] + public void NotRequiredNotnullableintegerPropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableintegerProp' + } + + /// + /// Test the property 'RequiredNullableStringProp' + /// + [Fact] + public void RequiredNullableStringPropTest() + { + // TODO unit test for the property 'RequiredNullableStringProp' + } + + /// + /// Test the property 'RequiredNotnullableStringProp' + /// + [Fact] + public void RequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'RequiredNotnullableStringProp' + } + + /// + /// Test the property 'NotrequiredNullableStringProp' + /// + [Fact] + public void NotrequiredNullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNullableStringProp' + } + + /// + /// Test the property 'NotrequiredNotnullableStringProp' + /// + [Fact] + public void NotrequiredNotnullableStringPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableStringProp' + } + + /// + /// Test the property 'RequiredNullableBooleanProp' + /// + [Fact] + public void RequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNullableBooleanProp' + } + + /// + /// Test the property 'RequiredNotnullableBooleanProp' + /// + [Fact] + public void RequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'RequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNullableBooleanProp' + /// + [Fact] + public void NotrequiredNullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNullableBooleanProp' + } + + /// + /// Test the property 'NotrequiredNotnullableBooleanProp' + /// + [Fact] + public void NotrequiredNotnullableBooleanPropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableBooleanProp' + } + + /// + /// Test the property 'RequiredNullableDateProp' + /// + [Fact] + public void RequiredNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNullableDateProp' + } + + /// + /// Test the property 'RequiredNotNullableDateProp' + /// + [Fact] + public void RequiredNotNullableDatePropTest() + { + // TODO unit test for the property 'RequiredNotNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNullableDateProp' + /// + [Fact] + public void NotRequiredNullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNullableDateProp' + } + + /// + /// Test the property 'NotRequiredNotnullableDateProp' + /// + [Fact] + public void NotRequiredNotnullableDatePropTest() + { + // TODO unit test for the property 'NotRequiredNotnullableDateProp' + } + + /// + /// Test the property 'RequiredNotnullableDatetimeProp' + /// + [Fact] + public void RequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableDatetimeProp' + /// + [Fact] + public void RequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'RequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNullableDatetimeProp' + /// + [Fact] + public void NotrequiredNullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNullableDatetimeProp' + } + + /// + /// Test the property 'NotrequiredNotnullableDatetimeProp' + /// + [Fact] + public void NotrequiredNotnullableDatetimePropTest() + { + // TODO unit test for the property 'NotrequiredNotnullableDatetimeProp' + } + + /// + /// Test the property 'RequiredNullableEnumInteger' + /// + [Fact] + public void RequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNullableEnumInteger' + } + + /// + /// Test the property 'RequiredNotnullableEnumInteger' + /// + [Fact] + public void RequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNullableEnumInteger' + /// + [Fact] + public void NotrequiredNullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumInteger' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumInteger' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumInteger' + } + + /// + /// Test the property 'RequiredNullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void RequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumIntegerOnly' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumIntegerOnly' + /// + [Fact] + public void NotrequiredNotnullableEnumIntegerOnlyTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumIntegerOnly' + } + + /// + /// Test the property 'RequiredNotnullableEnumString' + /// + [Fact] + public void RequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableEnumString' + /// + [Fact] + public void RequiredNullableEnumStringTest() + { + // TODO unit test for the property 'RequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNullableEnumString' + /// + [Fact] + public void NotrequiredNullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNullableEnumString' + } + + /// + /// Test the property 'NotrequiredNotnullableEnumString' + /// + [Fact] + public void NotrequiredNotnullableEnumStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableEnumString' + } + + /// + /// Test the property 'RequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void RequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'RequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'NotrequiredNotnullableOuterEnumDefaultValue' + /// + [Fact] + public void NotrequiredNotnullableOuterEnumDefaultValueTest() + { + // TODO unit test for the property 'NotrequiredNotnullableOuterEnumDefaultValue' + } + + /// + /// Test the property 'RequiredNullableUuid' + /// + [Fact] + public void RequiredNullableUuidTest() + { + // TODO unit test for the property 'RequiredNullableUuid' + } + + /// + /// Test the property 'RequiredNotnullableUuid' + /// + [Fact] + public void RequiredNotnullableUuidTest() + { + // TODO unit test for the property 'RequiredNotnullableUuid' + } + + /// + /// Test the property 'NotrequiredNullableUuid' + /// + [Fact] + public void NotrequiredNullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNullableUuid' + } + + /// + /// Test the property 'NotrequiredNotnullableUuid' + /// + [Fact] + public void NotrequiredNotnullableUuidTest() + { + // TODO unit test for the property 'NotrequiredNotnullableUuid' + } + + /// + /// Test the property 'RequiredNullableArrayOfString' + /// + [Fact] + public void RequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNullableArrayOfString' + } + + /// + /// Test the property 'RequiredNotnullableArrayOfString' + /// + [Fact] + public void RequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'RequiredNotnullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNullableArrayOfString' + /// + [Fact] + public void NotrequiredNullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNullableArrayOfString' + } + + /// + /// Test the property 'NotrequiredNotnullableArrayOfString' + /// + [Fact] + public void NotrequiredNotnullableArrayOfStringTest() + { + // TODO unit test for the property 'NotrequiredNotnullableArrayOfString' + } + } +} diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs index 120c4643d81e..f8cb3223116f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs @@ -142,28 +142,49 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (!regexCultivar.Match(this.Cultivar).Success) + if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } + + + + + + + // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexOrigin.Match(this.Origin).Success) + if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } + + + + + + + // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (!regexColorCode.Match(this.ColorCode).Success) + if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs index d5e9e3c94d41..11f08ffcb968 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -417,10 +417,17 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexVarString.Match(this.VarString).Success) + if (this.VarString != null && !regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } + + + + + + + // TODO: revert changes here } // Password (string) maxLength @@ -438,28 +445,49 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } + + + + + + + // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 0ecaac953c3c..1d9f5d51a23c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -155,10 +155,17 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } + + + + + + + // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs new file mode 100644 index 000000000000..9e1e29271350 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -0,0 +1,1027 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.IO; +using System.Runtime.Serialization; +using System.Text; +using System.Text.RegularExpressions; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; +using OpenAPIClientUtils = Org.OpenAPITools.Client.ClientUtils; + +namespace Org.OpenAPITools.Model +{ + /// + /// RequiredClass + /// + [DataContract(Name = "RequiredClass")] + public partial class RequiredClass : IEquatable, IValidatableObject + { + /// + /// Defines RequiredNullableEnumInteger + /// + public enum RequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNullableEnumInteger + /// + [DataMember(Name = "required_nullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerEnum RequiredNullableEnumInteger { get; set; } + /// + /// Defines RequiredNotnullableEnumInteger + /// + public enum RequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumInteger + /// + [DataMember(Name = "required_notnullable_enum_integer", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNullableEnumInteger + /// + public enum NotrequiredNullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumInteger + /// + [DataMember(Name = "notrequired_nullable_enum_integer", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get; set; } + /// + /// Defines NotrequiredNotnullableEnumInteger + /// + public enum NotrequiredNotnullableEnumIntegerEnum + { + /// + /// Enum NUMBER_1 for value: 1 + /// + NUMBER_1 = 1, + + /// + /// Enum NUMBER_MINUS_1 for value: -1 + /// + NUMBER_MINUS_1 = -1 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumInteger + /// + [DataMember(Name = "notrequired_notnullable_enum_integer", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get; set; } + /// + /// Defines RequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "required_nullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumIntegerOnly + /// + public enum RequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "required_notnullable_enum_integer_only", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNullableEnumIntegerOnly + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_nullable_enum_integer_only", EmitDefaultValue = true)] + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get; set; } + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 + /// + NUMBER_2 = 2, + + /// + /// Enum NUMBER_MINUS_2 for value: -2 + /// + NUMBER_MINUS_2 = -2 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// + [DataMember(Name = "notrequired_notnullable_enum_integer_only", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get; set; } + /// + /// Defines RequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNotnullableEnumString + /// + [DataMember(Name = "required_notnullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } + /// + /// Defines RequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum RequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets RequiredNullableEnumString + /// + [DataMember(Name = "required_nullable_enum_string", IsRequired = true, EmitDefaultValue = true)] + public RequiredNullableEnumStringEnum RequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNullableEnumString + /// + [DataMember(Name = "notrequired_nullable_enum_string", EmitDefaultValue = true)] + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get; set; } + /// + /// Defines NotrequiredNotnullableEnumString + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum NotrequiredNotnullableEnumStringEnum + { + /// + /// Enum UPPER for value: UPPER + /// + [EnumMember(Value = "UPPER")] + UPPER = 1, + + /// + /// Enum Lower for value: lower + /// + [EnumMember(Value = "lower")] + Lower = 2, + + /// + /// Enum Empty for value: + /// + [EnumMember(Value = "")] + Empty = 3, + + /// + /// Enum ValuewithTab for value: Value\twith tab + /// + [EnumMember(Value = "Value\twith tab")] + ValuewithTab = 4, + + /// + /// Enum ValueWithQuote for value: Value with \" quote + /// + [EnumMember(Value = "Value with \" quote")] + ValueWithQuote = 5, + + /// + /// Enum ValueWithEscapedQuote for value: Value with escaped \" quote + /// + [EnumMember(Value = "Value with escaped \" quote")] + ValueWithEscapedQuote = 6, + + /// + /// Enum Duplicatevalue for value: Duplicate\nvalue + /// + [EnumMember(Value = "Duplicate\nvalue")] + Duplicatevalue = 7, + + /// + /// Enum Duplicatevalue2 for value: Duplicate\r\nvalue + /// + [EnumMember(Value = "Duplicate\r\nvalue")] + Duplicatevalue2 = 8 + } + + + /// + /// Gets or Sets NotrequiredNotnullableEnumString + /// + [DataMember(Name = "notrequired_notnullable_enum_string", EmitDefaultValue = false)] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get; set; } + + /// + /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_nullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "required_notnullable_outerEnumDefaultValue", IsRequired = true, EmitDefaultValue = true)] + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_nullable_outerEnumDefaultValue", EmitDefaultValue = true)] + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [DataMember(Name = "notrequired_notnullable_outerEnumDefaultValue", EmitDefaultValue = false)] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get; set; } + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected RequiredClass() { } + /// + /// Initializes a new instance of the class. + /// + /// requiredNullableIntegerProp (required). + /// requiredNotnullableintegerProp (required). + /// notRequiredNullableIntegerProp. + /// notRequiredNotnullableintegerProp. + /// requiredNullableStringProp (required). + /// requiredNotnullableStringProp (required). + /// notrequiredNullableStringProp. + /// notrequiredNotnullableStringProp. + /// requiredNullableBooleanProp (required). + /// requiredNotnullableBooleanProp (required). + /// notrequiredNullableBooleanProp. + /// notrequiredNotnullableBooleanProp. + /// requiredNullableDateProp (required). + /// requiredNotNullableDateProp (required). + /// notRequiredNullableDateProp. + /// notRequiredNotnullableDateProp. + /// requiredNotnullableDatetimeProp (required). + /// requiredNullableDatetimeProp (required). + /// notrequiredNullableDatetimeProp. + /// notrequiredNotnullableDatetimeProp. + /// requiredNullableEnumInteger (required). + /// requiredNotnullableEnumInteger (required). + /// notrequiredNullableEnumInteger. + /// notrequiredNotnullableEnumInteger. + /// requiredNullableEnumIntegerOnly (required). + /// requiredNotnullableEnumIntegerOnly (required). + /// notrequiredNullableEnumIntegerOnly. + /// notrequiredNotnullableEnumIntegerOnly. + /// requiredNotnullableEnumString (required). + /// requiredNullableEnumString (required). + /// notrequiredNullableEnumString. + /// notrequiredNotnullableEnumString. + /// requiredNullableOuterEnumDefaultValue (required). + /// requiredNotnullableOuterEnumDefaultValue (required). + /// notrequiredNullableOuterEnumDefaultValue. + /// notrequiredNotnullableOuterEnumDefaultValue. + /// requiredNullableUuid (required). + /// requiredNotnullableUuid (required). + /// notrequiredNullableUuid. + /// notrequiredNotnullableUuid. + /// requiredNullableArrayOfString (required). + /// requiredNotnullableArrayOfString (required). + /// notrequiredNullableArrayOfString. + /// notrequiredNotnullableArrayOfString. + public RequiredClass(int? requiredNullableIntegerProp = default(int?), int requiredNotnullableintegerProp = default(int), int? notRequiredNullableIntegerProp = default(int?), int notRequiredNotnullableintegerProp = default(int), string requiredNullableStringProp = default(string), string requiredNotnullableStringProp = default(string), string notrequiredNullableStringProp = default(string), string notrequiredNotnullableStringProp = default(string), bool? requiredNullableBooleanProp = default(bool?), bool requiredNotnullableBooleanProp = default(bool), bool? notrequiredNullableBooleanProp = default(bool?), bool notrequiredNotnullableBooleanProp = default(bool), DateTime? requiredNullableDateProp = default(DateTime?), DateTime requiredNotNullableDateProp = default(DateTime), DateTime? notRequiredNullableDateProp = default(DateTime?), DateTime notRequiredNotnullableDateProp = default(DateTime), DateTime requiredNotnullableDatetimeProp = default(DateTime), DateTime? requiredNullableDatetimeProp = default(DateTime?), DateTime? notrequiredNullableDatetimeProp = default(DateTime?), DateTime notrequiredNotnullableDatetimeProp = default(DateTime), RequiredNullableEnumIntegerEnum requiredNullableEnumInteger = default(RequiredNullableEnumIntegerEnum), RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger = default(RequiredNotnullableEnumIntegerEnum), NotrequiredNullableEnumIntegerEnum? notrequiredNullableEnumInteger = default(NotrequiredNullableEnumIntegerEnum?), NotrequiredNotnullableEnumIntegerEnum? notrequiredNotnullableEnumInteger = default(NotrequiredNotnullableEnumIntegerEnum?), RequiredNullableEnumIntegerOnlyEnum requiredNullableEnumIntegerOnly = default(RequiredNullableEnumIntegerOnlyEnum), RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly = default(RequiredNotnullableEnumIntegerOnlyEnum), NotrequiredNullableEnumIntegerOnlyEnum? notrequiredNullableEnumIntegerOnly = default(NotrequiredNullableEnumIntegerOnlyEnum?), NotrequiredNotnullableEnumIntegerOnlyEnum? notrequiredNotnullableEnumIntegerOnly = default(NotrequiredNotnullableEnumIntegerOnlyEnum?), RequiredNotnullableEnumStringEnum requiredNotnullableEnumString = default(RequiredNotnullableEnumStringEnum), RequiredNullableEnumStringEnum requiredNullableEnumString = default(RequiredNullableEnumStringEnum), NotrequiredNullableEnumStringEnum? notrequiredNullableEnumString = default(NotrequiredNullableEnumStringEnum?), NotrequiredNotnullableEnumStringEnum? notrequiredNotnullableEnumString = default(NotrequiredNotnullableEnumStringEnum?), OuterEnumDefaultValue requiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue), OuterEnumDefaultValue? notrequiredNullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), OuterEnumDefaultValue? notrequiredNotnullableOuterEnumDefaultValue = default(OuterEnumDefaultValue?), Guid? requiredNullableUuid = default(Guid?), Guid requiredNotnullableUuid = default(Guid), Guid? notrequiredNullableUuid = default(Guid?), Guid notrequiredNotnullableUuid = default(Guid), List requiredNullableArrayOfString = default(List), List requiredNotnullableArrayOfString = default(List), List notrequiredNullableArrayOfString = default(List), List notrequiredNotnullableArrayOfString = default(List)) + { + // to ensure "requiredNullableIntegerProp" is required (not null) + if (requiredNullableIntegerProp == null) + { + throw new ArgumentNullException("requiredNullableIntegerProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableIntegerProp = requiredNullableIntegerProp; + this.RequiredNotnullableintegerProp = requiredNotnullableintegerProp; + // to ensure "requiredNullableStringProp" is required (not null) + if (requiredNullableStringProp == null) + { + throw new ArgumentNullException("requiredNullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableStringProp = requiredNullableStringProp; + // to ensure "requiredNotnullableStringProp" is required (not null) + if (requiredNotnullableStringProp == null) + { + throw new ArgumentNullException("requiredNotnullableStringProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableStringProp = requiredNotnullableStringProp; + // to ensure "requiredNullableBooleanProp" is required (not null) + if (requiredNullableBooleanProp == null) + { + throw new ArgumentNullException("requiredNullableBooleanProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableBooleanProp = requiredNullableBooleanProp; + this.RequiredNotnullableBooleanProp = requiredNotnullableBooleanProp; + // to ensure "requiredNullableDateProp" is required (not null) + if (requiredNullableDateProp == null) + { + throw new ArgumentNullException("requiredNullableDateProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDateProp = requiredNullableDateProp; + this.RequiredNotNullableDateProp = requiredNotNullableDateProp; + this.RequiredNotnullableDatetimeProp = requiredNotnullableDatetimeProp; + // to ensure "requiredNullableDatetimeProp" is required (not null) + if (requiredNullableDatetimeProp == null) + { + throw new ArgumentNullException("requiredNullableDatetimeProp is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableDatetimeProp = requiredNullableDatetimeProp; + this.RequiredNullableEnumInteger = requiredNullableEnumInteger; + this.RequiredNotnullableEnumInteger = requiredNotnullableEnumInteger; + this.RequiredNullableEnumIntegerOnly = requiredNullableEnumIntegerOnly; + this.RequiredNotnullableEnumIntegerOnly = requiredNotnullableEnumIntegerOnly; + this.RequiredNotnullableEnumString = requiredNotnullableEnumString; + this.RequiredNullableEnumString = requiredNullableEnumString; + this.RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; + this.RequiredNotnullableOuterEnumDefaultValue = requiredNotnullableOuterEnumDefaultValue; + // to ensure "requiredNullableUuid" is required (not null) + if (requiredNullableUuid == null) + { + throw new ArgumentNullException("requiredNullableUuid is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableUuid = requiredNullableUuid; + this.RequiredNotnullableUuid = requiredNotnullableUuid; + // to ensure "requiredNullableArrayOfString" is required (not null) + if (requiredNullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNullableArrayOfString = requiredNullableArrayOfString; + // to ensure "requiredNotnullableArrayOfString" is required (not null) + if (requiredNotnullableArrayOfString == null) + { + throw new ArgumentNullException("requiredNotnullableArrayOfString is a required property for RequiredClass and cannot be null"); + } + this.RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; + this.NotRequiredNullableIntegerProp = notRequiredNullableIntegerProp; + this.NotRequiredNotnullableintegerProp = notRequiredNotnullableintegerProp; + this.NotrequiredNullableStringProp = notrequiredNullableStringProp; + this.NotrequiredNotnullableStringProp = notrequiredNotnullableStringProp; + this.NotrequiredNullableBooleanProp = notrequiredNullableBooleanProp; + this.NotrequiredNotnullableBooleanProp = notrequiredNotnullableBooleanProp; + this.NotRequiredNullableDateProp = notRequiredNullableDateProp; + this.NotRequiredNotnullableDateProp = notRequiredNotnullableDateProp; + this.NotrequiredNullableDatetimeProp = notrequiredNullableDatetimeProp; + this.NotrequiredNotnullableDatetimeProp = notrequiredNotnullableDatetimeProp; + this.NotrequiredNullableEnumInteger = notrequiredNullableEnumInteger; + this.NotrequiredNotnullableEnumInteger = notrequiredNotnullableEnumInteger; + this.NotrequiredNullableEnumIntegerOnly = notrequiredNullableEnumIntegerOnly; + this.NotrequiredNotnullableEnumIntegerOnly = notrequiredNotnullableEnumIntegerOnly; + this.NotrequiredNullableEnumString = notrequiredNullableEnumString; + this.NotrequiredNotnullableEnumString = notrequiredNotnullableEnumString; + this.NotrequiredNullableOuterEnumDefaultValue = notrequiredNullableOuterEnumDefaultValue; + this.NotrequiredNotnullableOuterEnumDefaultValue = notrequiredNotnullableOuterEnumDefaultValue; + this.NotrequiredNullableUuid = notrequiredNullableUuid; + this.NotrequiredNotnullableUuid = notrequiredNotnullableUuid; + this.NotrequiredNullableArrayOfString = notrequiredNullableArrayOfString; + this.NotrequiredNotnullableArrayOfString = notrequiredNotnullableArrayOfString; + } + + /// + /// Gets or Sets RequiredNullableIntegerProp + /// + [DataMember(Name = "required_nullable_integer_prop", IsRequired = true, EmitDefaultValue = true)] + public int? RequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableintegerProp + /// + [DataMember(Name = "required_notnullableinteger_prop", IsRequired = true, EmitDefaultValue = true)] + public int RequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableIntegerProp + /// + [DataMember(Name = "not_required_nullable_integer_prop", EmitDefaultValue = true)] + public int? NotRequiredNullableIntegerProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableintegerProp + /// + [DataMember(Name = "not_required_notnullableinteger_prop", EmitDefaultValue = false)] + public int NotRequiredNotnullableintegerProp { get; set; } + + /// + /// Gets or Sets RequiredNullableStringProp + /// + [DataMember(Name = "required_nullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableStringProp + /// + [DataMember(Name = "required_notnullable_string_prop", IsRequired = true, EmitDefaultValue = true)] + public string RequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableStringProp + /// + [DataMember(Name = "notrequired_nullable_string_prop", EmitDefaultValue = true)] + public string NotrequiredNullableStringProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableStringProp + /// + [DataMember(Name = "notrequired_notnullable_string_prop", EmitDefaultValue = false)] + public string NotrequiredNotnullableStringProp { get; set; } + + /// + /// Gets or Sets RequiredNullableBooleanProp + /// + [DataMember(Name = "required_nullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool? RequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableBooleanProp + /// + [DataMember(Name = "required_notnullable_boolean_prop", IsRequired = true, EmitDefaultValue = true)] + public bool RequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableBooleanProp + /// + [DataMember(Name = "notrequired_nullable_boolean_prop", EmitDefaultValue = true)] + public bool? NotrequiredNullableBooleanProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableBooleanProp + /// + [DataMember(Name = "notrequired_notnullable_boolean_prop", EmitDefaultValue = true)] + public bool NotrequiredNotnullableBooleanProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDateProp + /// + [DataMember(Name = "required_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? RequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotNullableDateProp + /// + [DataMember(Name = "required_not_nullable_date_prop", IsRequired = true, EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime RequiredNotNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNullableDateProp + /// + [DataMember(Name = "not_required_nullable_date_prop", EmitDefaultValue = true)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime? NotRequiredNullableDateProp { get; set; } + + /// + /// Gets or Sets NotRequiredNotnullableDateProp + /// + [DataMember(Name = "not_required_notnullable_date_prop", EmitDefaultValue = false)] + [JsonConverter(typeof(OpenAPIDateConverter))] + public DateTime NotRequiredNotnullableDateProp { get; set; } + + /// + /// Gets or Sets RequiredNotnullableDatetimeProp + /// + [DataMember(Name = "required_notnullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime RequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableDatetimeProp + /// + [DataMember(Name = "required_nullable_datetime_prop", IsRequired = true, EmitDefaultValue = true)] + public DateTime? RequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNullableDatetimeProp + /// + [DataMember(Name = "notrequired_nullable_datetime_prop", EmitDefaultValue = true)] + public DateTime? NotrequiredNullableDatetimeProp { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// + [DataMember(Name = "notrequired_notnullable_datetime_prop", EmitDefaultValue = false)] + public DateTime NotrequiredNotnullableDatetimeProp { get; set; } + + /// + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_nullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "required_notnullable_uuid", IsRequired = true, EmitDefaultValue = true)] + public Guid RequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_nullable_uuid", EmitDefaultValue = true)] + public Guid? NotrequiredNullableUuid { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [DataMember(Name = "notrequired_notnullable_uuid", EmitDefaultValue = false)] + public Guid NotrequiredNotnullableUuid { get; set; } + + /// + /// Gets or Sets RequiredNullableArrayOfString + /// + [DataMember(Name = "required_nullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets RequiredNotnullableArrayOfString + /// + [DataMember(Name = "required_notnullable_array_of_string", IsRequired = true, EmitDefaultValue = true)] + public List RequiredNotnullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNullableArrayOfString + /// + [DataMember(Name = "notrequired_nullable_array_of_string", EmitDefaultValue = true)] + public List NotrequiredNullableArrayOfString { get; set; } + + /// + /// Gets or Sets NotrequiredNotnullableArrayOfString + /// + [DataMember(Name = "notrequired_notnullable_array_of_string", EmitDefaultValue = false)] + public List NotrequiredNotnullableArrayOfString { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class RequiredClass {\n"); + sb.Append(" RequiredNullableIntegerProp: ").Append(RequiredNullableIntegerProp).Append("\n"); + sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); + sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); + sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); + sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNullableStringProp: ").Append(NotrequiredNullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); + sb.Append(" RequiredNotnullableBooleanProp: ").Append(RequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); + sb.Append(" RequiredNotNullableDateProp: ").Append(RequiredNotNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" RequiredNotnullableDatetimeProp: ").Append(RequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableDatetimeProp: ").Append(RequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" RequiredNullableEnumInteger: ").Append(RequiredNullableEnumInteger).Append("\n"); + sb.Append(" RequiredNotnullableEnumInteger: ").Append(RequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNullableEnumInteger: ").Append(NotrequiredNullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" RequiredNullableEnumIntegerOnly: ").Append(RequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumIntegerOnly: ").Append(RequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNullableEnumIntegerOnly: ").Append(NotrequiredNullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" RequiredNotnullableEnumString: ").Append(RequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableEnumString: ").Append(RequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNullableEnumString: ").Append(NotrequiredNullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNotnullableOuterEnumDefaultValue: ").Append(RequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNullableOuterEnumDefaultValue: ").Append(NotrequiredNullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); + sb.Append(" NotrequiredNullableUuid: ").Append(NotrequiredNullableUuid).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); + sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); + sb.Append(" RequiredNotnullableArrayOfString: ").Append(RequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input as RequiredClass).AreEqual; + } + + /// + /// Returns true if RequiredClass instances are equal + /// + /// Instance of RequiredClass to be compared + /// Boolean + public bool Equals(RequiredClass input) + { + return OpenAPIClientUtils.compareLogic.Compare(this, input).AreEqual; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.RequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableintegerProp.GetHashCode(); + if (this.NotRequiredNullableIntegerProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableIntegerProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotRequiredNotnullableintegerProp.GetHashCode(); + if (this.RequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableStringProp.GetHashCode(); + } + if (this.RequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableStringProp.GetHashCode(); + } + if (this.NotrequiredNullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableStringProp.GetHashCode(); + } + if (this.NotrequiredNotnullableStringProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableStringProp.GetHashCode(); + } + if (this.RequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNotnullableBooleanProp.GetHashCode(); + if (this.NotrequiredNullableBooleanProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableBooleanProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.NotrequiredNotnullableBooleanProp.GetHashCode(); + if (this.RequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDateProp.GetHashCode(); + } + if (this.RequiredNotNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNullableDateProp.GetHashCode(); + } + if (this.NotRequiredNotnullableDateProp != null) + { + hashCode = (hashCode * 59) + this.NotRequiredNotnullableDateProp.GetHashCode(); + } + if (this.RequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableDatetimeProp.GetHashCode(); + } + if (this.RequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableDatetimeProp.GetHashCode(); + } + if (this.NotrequiredNotnullableDatetimeProp != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableDatetimeProp.GetHashCode(); + } + hashCode = (hashCode * 59) + this.RequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumInteger.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumIntegerOnly.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableEnumString.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.RequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNullableOuterEnumDefaultValue.GetHashCode(); + hashCode = (hashCode * 59) + this.NotrequiredNotnullableOuterEnumDefaultValue.GetHashCode(); + if (this.RequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableUuid.GetHashCode(); + } + if (this.RequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableUuid.GetHashCode(); + } + if (this.NotrequiredNullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableUuid.GetHashCode(); + } + if (this.NotrequiredNotnullableUuid != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableUuid.GetHashCode(); + } + if (this.RequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNullableArrayOfString.GetHashCode(); + } + if (this.RequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.RequiredNotnullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNullableArrayOfString.GetHashCode(); + } + if (this.NotrequiredNotnullableArrayOfString != null) + { + hashCode = (hashCode * 59) + this.NotrequiredNotnullableArrayOfString.GetHashCode(); + } + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs index 968c28f9a2cb..730319f8038b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs @@ -126,10 +126,17 @@ public override int GetHashCode() if (this.Name != null) { // Name (string) pattern Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); - if (!regexName.Match(this.Name).Success) + if (this.Name != null && !regexName.Match(this.Name).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); } + + + + + + + // TODO: revert changes here } yield break; From 3af40a2910d0e9fac22762c5f67f953ad08e0fdc Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 13:35:34 -0500 Subject: [PATCH 16/23] fix npe --- .../templating/mustache/PasteLambda.java | 4 ++ .../.openapi-generator/VERSION | 2 +- .../src/Org.OpenAPITools/Model/Animal.cs | 2 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 2 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 4 +- .../src/Org.OpenAPITools/Model/Banana.cs | 2 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 4 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 2 +- .../src/Org.OpenAPITools/Model/Cat.cs | 4 +- .../src/Org.OpenAPITools/Model/Category.cs | 4 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 +- .../Model/ComplexQuadrilateral.cs | 2 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 4 +- .../src/Org.OpenAPITools/Model/Dog.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 20 ++++----- .../Model/EquilateralTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 22 +++++----- .../Model/GrandparentAnimal.cs | 2 +- .../Model/IsoscelesTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 6 +-- ...dPropertiesAndAdditionalPropertiesClass.cs | 8 ++-- .../Model/Model200Response.cs | 2 +- .../src/Org.OpenAPITools/Model/Name.cs | 6 +-- ...cationtestGetElementsV1ResponseMPayload.cs | 2 +- .../Org.OpenAPITools/Model/NullableClass.cs | 10 ++--- .../Model/NullableGuidClass.cs | 2 +- .../Org.OpenAPITools/Model/NullableShape.cs | 4 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 2 +- .../Model/ObjectWithDeprecatedFields.cs | 2 +- .../src/Org.OpenAPITools/Model/Order.cs | 12 +++--- .../Org.OpenAPITools/Model/OuterComposite.cs | 4 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 2 +- .../src/Org.OpenAPITools/Model/Pet.cs | 6 +-- .../src/Org.OpenAPITools/Model/Pig.cs | 4 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 4 +- .../Model/QuadrilateralInterface.cs | 2 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 42 +++++++++---------- .../src/Org.OpenAPITools/Model/Return.cs | 2 +- .../Model/RolesReportsHash.cs | 2 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 2 +- .../src/Org.OpenAPITools/Model/Shape.cs | 4 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 4 +- .../Model/SimpleQuadrilateral.cs | 2 +- .../Model/SpecialModelName.cs | 2 +- .../src/Org.OpenAPITools/Model/Tag.cs | 2 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 6 +-- .../Model/TriangleInterface.cs | 2 +- .../src/Org.OpenAPITools/Model/User.cs | 4 +- .../src/Org.OpenAPITools/Model/Whale.cs | 6 +-- .../src/Org.OpenAPITools/Model/Zebra.cs | 4 +- .../Model/ZeroBasedEnumClass.cs | 2 +- .../.openapi-generator/VERSION | 2 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 2 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 2 +- 57 files changed, 134 insertions(+), 130 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java index c9d5e0146bb2..8a78457176d3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java @@ -54,6 +54,10 @@ public PasteLambda(CopyLambda copyLambda, Boolean stripLeading, Boolean stripTra public void execute(Fragment fragment, Writer writer) throws IOException { String content = this.copyLambda.savedContent; + if (content == null) { + return; + } + if (this.stripTrailing){ content = content.stripTrailing(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index 9db2adcbc81b..f520a695290e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -165,7 +165,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className.Value!, color); // a + return new Animal(className.Value, color); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index b08f81ab4cae..29b967d25965 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -215,7 +215,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); if (apiResponse.CodeOption.IsSet) - writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); // 3 if (apiResponse.MessageOption.IsSet) writer.WriteString("message", apiResponse.Message); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index 7d5db4a1a503..675c8f332544 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -149,7 +149,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (mealy.IsSet && mealy.Value == null) throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar.Value!, mealy); // a + return new AppleReq(cultivar.Value, mealy); // a } /// @@ -182,7 +182,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe writer.WriteString("cultivar", appleReq.Cultivar); // 1 if (appleReq.MealyOption.IsSet) - writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index 6b08db748029..8cf5fb88f34a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.LengthCmOption.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index f2c057edfca2..3cea251bb36a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -150,7 +150,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (sweet.IsSet && sweet.Value == null) throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value!.Value!, sweet); // a + return new BananaReq(lengthCm.Value.Value, sweet); // a } /// @@ -180,7 +180,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, Json writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 if (bananaReq.SweetOption.IsSet) - writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index 44636fd4260b..3c2aaf08e492 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -133,7 +133,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - return new BasquePig(className.Value!); // a + return new BasquePig(className.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 129a67d07531..307f19f4682d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -140,7 +140,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value!, declawed, color); // a + return new Cat(className.Value, declawed, color); // a } /// @@ -176,7 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp writer.WriteString("className", cat.ClassName); // 1 if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); // 2 if (cat.ColorOption.IsSet) writer.WriteString("color", cat.Color); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index 6c48c0199725..e95584756da5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -156,7 +156,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value!, id); // a + return new Category(name.Value, id); // a } /// @@ -189,7 +189,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe writer.WriteString("name", category.Name); // 1 if (category.IdOption.IsSet) - writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", category.IdOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index db2c93fe72f2..100ad6956008 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -229,7 +229,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe if (childCat.NameOption.IsSet) writer.WriteString("name", childCat.Name); // 1 - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); // 7 if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 1d0c9f3fd5e6..2ba439964da6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -152,7 +152,7 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 5881871fdc04..2310e9adb29f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -133,7 +133,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - return new DanishPig(className.Value!); // a + return new DanishPig(className.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 0a3e1fda586d..2950805954ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -51,7 +51,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d @@ -171,7 +171,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyPropertyOption.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); // 4 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index a7a3656d0aa4..4bf73f9f8b23 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -139,7 +139,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(className.Value!, breed, color); // a + return new Dog(className.Value, breed, color); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 45e29880f62f..46723a8556a4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -326,7 +326,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js if (enumArrays.ArrayEnumOption.IsSet) // 14 writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); // 7 if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index c9b8ad0f232f..8d739b80f265 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -805,7 +805,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a } /// @@ -839,15 +839,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe writer.WriteNull("enum_string_required"); if (enumTest.EnumIntegerOption.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); // 6 if (enumTest.EnumIntegerOnlyOption.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); // 6 if (enumTest.EnumNumberOption.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); // 6 - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); // 7 if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else @@ -855,23 +855,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); // 10 b writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); } if (enumTest.OuterEnumIntegerOption.IsSet) // 10 { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); // 10 b writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); // 10 b writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } if (enumTest.OuterEnumOption.IsSet) // 10 - if (enumTest.OuterEnumOption!.Value != null) // 10 a + if (enumTest.OuterEnumOption.Value != null) // 10 a { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); // 10 c writer.WriteString("outerEnum", outerEnumRawValue); } else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index e37ce92d92a9..7e719d26f712 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -152,7 +152,7 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a + return new EquilateralTriangle(shapeType.Value, triangleType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 2eeffd23f488..8fa75d4c161d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -87,7 +87,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } // d @@ -674,7 +674,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a } /// @@ -734,25 +734,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTimeOption.IsSet) - writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 if (formatTest.VarDecimalOption.IsSet) // 14 writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDoubleOption.IsSet) - writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); // 3 if (formatTest.VarFloatOption.IsSet) - writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); // 3 if (formatTest.Int32Option.IsSet) - writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); // 3 if (formatTest.Int64Option.IsSet) - writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); // 3 if (formatTest.IntegerOption.IsSet) - writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); // 3 if (formatTest.PatternWithBackslashOption.IsSet) writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 @@ -767,13 +767,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteString("string", formatTest.VarString); // 1 if (formatTest.UnsignedIntegerOption.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); // 3 if (formatTest.UnsignedLongOption.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); // 3 if (formatTest.UuidOption.IsSet) - writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 5ff4fe800bfb..104b1e543cd8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -143,7 +143,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - return new GrandparentAnimal(petType.Value!); // a + return new GrandparentAnimal(petType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index da3be2221d8a..f28b3dceafe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -145,7 +145,7 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 865228b52539..14518765c768 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -223,13 +223,13 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className.Value!); // c + return new Mammal(pig, className.Value); // c if (whale != null) - return new Mammal(whale, className.Value!); // c + return new Mammal(whale, className.Value); // c if (zebra != null) - return new Mammal(zebra, className.Value!); // c + return new Mammal(zebra, className.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index fb24dc40b09a..7ebb1eaa01e3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -129,7 +129,7 @@ public override string ToString() // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()!).Success) + if (this.UuidWithPatternOption.Value != null &&!regexUuidWithPattern.Match(this.UuidWithPatternOption.Value.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } @@ -249,16 +249,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); // 11 if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index e4186b32440e..53aa7ea41a27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -193,7 +193,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 writer.WriteString("class", model200Response.VarClass); // 1 if (model200Response.NameOption.IsSet) - writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 + writer.WriteNumber("name", model200Response.NameOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index f1727bc48f4f..9543525c067d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -243,7 +243,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123Number.IsSet && var123Number.Value == null) throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a + return new Name(varName.Value.Value, property, snakeCase, var123Number); // a } /// @@ -279,10 +279,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer writer.WriteString("property", name.Property); // 1 if (name.SnakeCaseOption.IsSet) - writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); // 3 if (name.Var123NumberOption.IsSet) - writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 2a9cd20a4a70..e91111bfa6af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -154,7 +154,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 164ffab196f1..28daf2558be5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -437,31 +437,31 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("array_nullable_prop"); if (nullableClass.BooleanPropOption.IsSet) if (nullableClass.BooleanPropOption.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); // 2 else writer.WriteNull("boolean_prop"); if (nullableClass.DatePropOption.IsSet) if (nullableClass.DatePropOption.Value != null) - writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); // 4 else writer.WriteNull("date_prop"); if (nullableClass.DatetimePropOption.IsSet) if (nullableClass.DatetimePropOption.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); // 5 else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerPropOption.IsSet) if (nullableClass.IntegerPropOption.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); // 3 else writer.WriteNull("integer_prop"); if (nullableClass.NumberPropOption.IsSet) if (nullableClass.NumberPropOption.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); // 3 else writer.WriteNull("number_prop"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index ce93066cda32..8bcf65599477 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -164,7 +164,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.UuidOption.IsSet) if (nullableGuidClass.UuidOption.Value != null) - writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); // 11 else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index b78d55de1444..de01979e880b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -200,10 +200,10 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType.Value!); // c + return new NullableShape(quadrilateral, shapeType.Value); // c if (triangle != null) - return new NullableShape(triangle, shapeType.Value!); // c + return new NullableShape(triangle, shapeType.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 1076161e96ce..110600467404 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { if (numberOnly.JustNumberOption.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 8d1521c2a30d..f70cb11eb40b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -251,7 +251,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.IdOption.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); // 3 if (objectWithDeprecatedFields.UuidOption.IsSet) writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index 22475999e083..a214e51ab8bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -369,25 +369,25 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { if (order.IdOption.IsSet) - writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", order.IdOption.Value.Value); // 3 if (order.PetIdOption.IsSet) - writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + writer.WriteNumber("petId", order.PetIdOption.Value.Value); // 3 if (order.QuantityOption.IsSet) - writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); // 3 if (order.ShipDateOption.IsSet) - writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); // 5 - var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index e4aa6c30a7c6..b8767f3b50fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -213,10 +213,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); if (outerComposite.MyBooleanOption.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); // 2 if (outerComposite.MyNumberOption.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); // 3 if (outerComposite.MyStringOption.IsSet) writer.WriteString("my_string", outerComposite.MyString); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index fb7e69bbe4c9..9c292f10c059 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -109,7 +109,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - return new ParentPet(petType.Value!); // a + return new ParentPet(petType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 5ba524071188..9733663c31e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -329,7 +329,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (tags.IsSet && tags.Value == null) throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); // a } /// @@ -376,9 +376,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); if (pet.IdOption.IsSet) - writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", pet.IdOption.Value.Value); // 3 - var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); // 7 if (statusRawValue != null) writer.WriteString("status", statusRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index e523ab4cf7d4..f1eb3e0e3145 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -200,10 +200,10 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className.Value!); // c + return new Pig(basquePig, className.Value); // c if (danishPig != null) - return new Pig(danishPig, className.Value!); // c + return new Pig(danishPig, className.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 361ee03b2c66..2c238cd4ce3a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -200,10 +200,10 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); // c if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index e5325f631f49..69c52bc4bafc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -133,7 +133,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T if (quadrilateralType.IsSet && quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType.Value!); // a + return new QuadrilateralInterface(quadrilateralType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index aa4bc1dd4971..66f9dacd78d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -2120,7 +2120,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a } /// @@ -2187,27 +2187,27 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); // 3 if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); // 2 if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); // 6 if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); // 6 - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); // 7 if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else @@ -2215,14 +2215,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); // 10 b writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); // 11 if (requiredClass.RequiredNullableArrayOfString != null) // 12 { @@ -2256,7 +2256,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); // 7 if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else @@ -2290,13 +2290,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); // 3 else writer.WriteNull("not_required_nullable_integer_prop"); @@ -2310,38 +2310,38 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_array_of_string"); if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); // 2 else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); // 6 else writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); // 6 else writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); // 7 if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) // 10 a { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); // 10 c writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); } else @@ -2354,7 +2354,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNullableUuidOption.IsSet) if (requiredClass.NotrequiredNullableUuidOption.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); // 11 else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index 8cc08b09316a..2c0b12129a68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { if (varReturn.VarReturnOption.IsSet) - writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index f953c8b0fadb..99a366447d5f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -194,7 +194,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuidOption.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); // 11 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 6e9e826d22db..7f53a5055a5b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -152,7 +152,7 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a + return new ScaleneTriangle(shapeType.Value, triangleType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index 49209ef9dd5e..0f3e3ae6ee76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -200,10 +200,10 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType.Value!); // c + return new Shape(quadrilateral, shapeType.Value); // c if (triangle != null) - return new Shape(triangle, shapeType.Value!); // c + return new Shape(triangle, shapeType.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 107fd5c5b50d..9e7193f38251 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -133,7 +133,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - return new ShapeInterface(shapeType.Value!); // a + return new ShapeInterface(shapeType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 6d2a3cf825fc..3fdfa16615cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -200,10 +200,10 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType.Value!); // c + return new ShapeOrNull(quadrilateral, shapeType.Value); // c if (triangle != null) - return new ShapeOrNull(triangle, shapeType.Value!); // c + return new ShapeOrNull(triangle, shapeType.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index d4b69fe3cfd7..0edbb338199b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -152,7 +152,7 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 9dcde944d87d..3ef8f5e2c981 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -193,7 +193,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 if (specialModelName.SpecialPropertyNameOption.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); // 3 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index 9b5a9c908653..e637b595099f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -190,7 +190,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); if (tag.IdOption.IsSet) - writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", tag.IdOption.Value.Value); // 3 if (tag.NameOption.IsSet) writer.WriteString("name", tag.Name); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index 7bf6112e9061..ca5cf704e909 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -223,13 +223,13 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType.Value!); // c + return new Triangle(equilateralTriangle, triangleType.Value); // c if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType.Value!); // c + return new Triangle(isoscelesTriangle, triangleType.Value); // c if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType.Value!); // c + return new Triangle(scaleneTriangle, triangleType.Value); // c throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index ff8c445e09f7..f21bcd8522f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -133,7 +133,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - return new TriangleInterface(triangleType.Value!); // a + return new TriangleInterface(triangleType.Value); // a } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index 29c96c8dda9a..d4916fd06dd6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -435,7 +435,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("firstName", user.FirstName); // 1 if (user.IdOption.IsSet) - writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", user.IdOption.Value.Value); // 3 if (user.LastNameOption.IsSet) writer.WriteString("lastName", user.LastName); // 1 @@ -450,7 +450,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("phone", user.Phone); // 1 if (user.UserStatusOption.IsSet) - writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); // 3 if (user.UsernameOption.IsSet) writer.WriteString("username", user.Username); // 1 diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index a126a02ca047..eb7088c40948 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -179,7 +179,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (hasTeeth.IsSet && hasTeeth.Value == null) throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className.Value!, hasBaleen, hasTeeth); // a + return new Whale(className.Value, hasBaleen, hasTeeth); // a } /// @@ -212,10 +212,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ writer.WriteString("className", whale.ClassName); // 1 if (whale.HasBaleenOption.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); // 2 if (whale.HasTeethOption.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); // 2 } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 601d83a6a269..bf8b978f048a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -248,7 +248,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className.Value!, type); // a + return new Zebra(className.Value, type); // a } /// @@ -280,7 +280,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ writer.WriteString("className", zebra.ClassName); // 1 - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); // 7 if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 8230f6a7f0b0..dda9c5f3d9a2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -231,7 +231,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); // 7 if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION index 717311e32e3c..40e36364ab27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/.openapi-generator/VERSION @@ -1 +1 @@ -unset \ No newline at end of file +7.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 22f08d342b58..747c241377cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -51,7 +51,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// /// Gets or Sets DateOnlyProperty /// - /// Thu Jul 20 20:00:00 EDT 2017 + /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option(value); } } // d diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index 2275cef21cd6..b80db04cfbf1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -87,7 +87,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// /// Gets or Sets Date /// - /// Sat Feb 01 19:00:00 EST 2020 + /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] public DateTime Date { get; set; } // d From e703fae1620f5eb8cb32692b6b4124751f18eaf7 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 14:42:31 -0500 Subject: [PATCH 17/23] removed debugging lines --- .../generichost/JsonConverter.mustache | 42 ++-- .../generichost/modelGeneric.mustache | 16 +- .../src/UseSourceGeneration/Model/Activity.cs | 8 +- .../ActivityOutputElementRepresentation.cs | 14 +- .../Model/AdditionalPropertiesClass.cs | 50 ++-- .../src/UseSourceGeneration/Model/Animal.cs | 12 +- .../UseSourceGeneration/Model/ApiResponse.cs | 20 +- .../src/UseSourceGeneration/Model/Apple.cs | 20 +- .../src/UseSourceGeneration/Model/AppleReq.cs | 12 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 8 +- .../Model/ArrayOfNumberOnly.cs | 8 +- .../UseSourceGeneration/Model/ArrayTest.cs | 20 +- .../src/UseSourceGeneration/Model/Banana.cs | 8 +- .../UseSourceGeneration/Model/BananaReq.cs | 12 +- .../UseSourceGeneration/Model/BasquePig.cs | 6 +- .../Model/Capitalization.cs | 38 +-- .../src/UseSourceGeneration/Model/Cat.cs | 12 +- .../src/UseSourceGeneration/Model/Category.cs | 12 +- .../src/UseSourceGeneration/Model/ChildCat.cs | 14 +- .../UseSourceGeneration/Model/ClassModel.cs | 8 +- .../Model/ComplexQuadrilateral.cs | 10 +- .../UseSourceGeneration/Model/DanishPig.cs | 6 +- .../Model/DateOnlyClass.cs | 8 +- .../Model/DeprecatedObject.cs | 8 +- .../src/UseSourceGeneration/Model/Dog.cs | 12 +- .../src/UseSourceGeneration/Model/Drawing.cs | 26 +- .../UseSourceGeneration/Model/EnumArrays.cs | 14 +- .../src/UseSourceGeneration/Model/EnumTest.cs | 64 ++--- .../Model/EquilateralTriangle.cs | 10 +- .../src/UseSourceGeneration/Model/File.cs | 8 +- .../Model/FileSchemaTestClass.cs | 14 +- .../src/UseSourceGeneration/Model/Foo.cs | 8 +- .../Model/FooGetDefaultResponse.cs | 8 +- .../UseSourceGeneration/Model/FormatTest.cs | 108 ++++---- .../src/UseSourceGeneration/Model/Fruit.cs | 10 +- .../src/UseSourceGeneration/Model/FruitReq.cs | 4 +- .../src/UseSourceGeneration/Model/GmFruit.cs | 16 +- .../Model/GrandparentAnimal.cs | 6 +- .../Model/HasOnlyReadOnly.cs | 14 +- .../Model/HealthCheckResult.cs | 8 +- .../Model/IsoscelesTriangle.cs | 10 +- .../src/UseSourceGeneration/Model/List.cs | 8 +- .../Model/LiteralStringClass.cs | 14 +- .../src/UseSourceGeneration/Model/Mammal.cs | 10 +- .../src/UseSourceGeneration/Model/MapTest.cs | 26 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 26 +- .../Model/Model200Response.cs | 14 +- .../UseSourceGeneration/Model/ModelClient.cs | 8 +- .../src/UseSourceGeneration/Model/Name.cs | 24 +- ...cationtestGetElementsV1ResponseMPayload.cs | 10 +- .../Model/NullableClass.cs | 74 +++--- .../Model/NullableGuidClass.cs | 8 +- .../Model/NullableShape.cs | 8 +- .../UseSourceGeneration/Model/NumberOnly.cs | 8 +- .../Model/ObjectWithDeprecatedFields.cs | 26 +- .../UseSourceGeneration/Model/OneOfString.cs | 4 +- .../src/UseSourceGeneration/Model/Order.cs | 38 +-- .../Model/OuterComposite.cs | 20 +- .../UseSourceGeneration/Model/ParentPet.cs | 4 +- .../src/UseSourceGeneration/Model/Pet.cs | 34 +-- .../src/UseSourceGeneration/Model/Pig.cs | 8 +- .../Model/PolymorphicProperty.cs | 8 +- .../Model/Quadrilateral.cs | 8 +- .../Model/QuadrilateralInterface.cs | 6 +- .../Model/ReadOnlyFirst.cs | 14 +- .../Model/RequiredClass.cs | 230 +++++++++--------- .../src/UseSourceGeneration/Model/Return.cs | 8 +- .../Model/RolesReportsHash.cs | 14 +- .../Model/RolesReportsHashRole.cs | 8 +- .../Model/ScaleneTriangle.cs | 10 +- .../src/UseSourceGeneration/Model/Shape.cs | 8 +- .../Model/ShapeInterface.cs | 6 +- .../UseSourceGeneration/Model/ShapeOrNull.cs | 8 +- .../Model/SimpleQuadrilateral.cs | 10 +- .../Model/SpecialModelName.cs | 14 +- .../src/UseSourceGeneration/Model/Tag.cs | 14 +- .../Model/TestCollectionEndingWithWordList.cs | 8 +- .../TestCollectionEndingWithWordListObject.cs | 8 +- ...lineFreeformAdditionalPropertiesRequest.cs | 8 +- .../src/UseSourceGeneration/Model/Triangle.cs | 10 +- .../Model/TriangleInterface.cs | 6 +- .../src/UseSourceGeneration/Model/User.cs | 74 +++--- .../src/UseSourceGeneration/Model/Whale.cs | 18 +- .../src/UseSourceGeneration/Model/Zebra.cs | 12 +- .../Model/ZeroBasedEnumClass.cs | 8 +- .../src/Org.OpenAPITools/Model/Activity.cs | 8 +- .../ActivityOutputElementRepresentation.cs | 14 +- .../Model/AdditionalPropertiesClass.cs | 50 ++-- .../src/Org.OpenAPITools/Model/Animal.cs | 12 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 20 +- .../src/Org.OpenAPITools/Model/Apple.cs | 20 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 12 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 8 +- .../Model/ArrayOfNumberOnly.cs | 8 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 20 +- .../src/Org.OpenAPITools/Model/Banana.cs | 8 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 12 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 6 +- .../Org.OpenAPITools/Model/Capitalization.cs | 38 +-- .../src/Org.OpenAPITools/Model/Cat.cs | 12 +- .../src/Org.OpenAPITools/Model/Category.cs | 12 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 14 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 8 +- .../Model/ComplexQuadrilateral.cs | 10 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 6 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 8 +- .../Model/DeprecatedObject.cs | 8 +- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 26 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 14 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 ++--- .../Model/EquilateralTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/File.cs | 8 +- .../Model/FileSchemaTestClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Foo.cs | 8 +- .../Model/FooGetDefaultResponse.cs | 8 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 108 ++++---- .../src/Org.OpenAPITools/Model/Fruit.cs | 10 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 4 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 16 +- .../Model/GrandparentAnimal.cs | 6 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 14 +- .../Model/HealthCheckResult.cs | 8 +- .../Model/IsoscelesTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/List.cs | 8 +- .../Model/LiteralStringClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 10 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 26 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 26 +- .../Model/Model200Response.cs | 14 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 24 +- ...cationtestGetElementsV1ResponseMPayload.cs | 10 +- .../Org.OpenAPITools/Model/NullableClass.cs | 74 +++--- .../Model/NullableGuidClass.cs | 8 +- .../Org.OpenAPITools/Model/NullableShape.cs | 8 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 8 +- .../Model/ObjectWithDeprecatedFields.cs | 26 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 4 +- .../src/Org.OpenAPITools/Model/Order.cs | 38 +-- .../Org.OpenAPITools/Model/OuterComposite.cs | 20 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 4 +- .../src/Org.OpenAPITools/Model/Pet.cs | 34 +-- .../src/Org.OpenAPITools/Model/Pig.cs | 8 +- .../Model/PolymorphicProperty.cs | 8 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 8 +- .../Model/QuadrilateralInterface.cs | 6 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 14 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 230 +++++++++--------- .../src/Org.OpenAPITools/Model/Return.cs | 8 +- .../Model/RolesReportsHash.cs | 14 +- .../Model/RolesReportsHashRole.cs | 8 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/Shape.cs | 8 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 8 +- .../Model/SimpleQuadrilateral.cs | 10 +- .../Model/SpecialModelName.cs | 14 +- .../src/Org.OpenAPITools/Model/Tag.cs | 14 +- .../Model/TestCollectionEndingWithWordList.cs | 8 +- .../TestCollectionEndingWithWordListObject.cs | 8 +- ...lineFreeformAdditionalPropertiesRequest.cs | 8 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 10 +- .../Model/TriangleInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/User.cs | 74 +++--- .../src/Org.OpenAPITools/Model/Whale.cs | 18 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 12 +- .../Model/ZeroBasedEnumClass.cs | 8 +- .../src/Org.OpenAPITools/Model/Activity.cs | 8 +- .../ActivityOutputElementRepresentation.cs | 14 +- .../Model/AdditionalPropertiesClass.cs | 50 ++-- .../src/Org.OpenAPITools/Model/Animal.cs | 12 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 20 +- .../src/Org.OpenAPITools/Model/Apple.cs | 20 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 12 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 8 +- .../Model/ArrayOfNumberOnly.cs | 8 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 20 +- .../src/Org.OpenAPITools/Model/Banana.cs | 8 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 12 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 6 +- .../Org.OpenAPITools/Model/Capitalization.cs | 38 +-- .../src/Org.OpenAPITools/Model/Cat.cs | 12 +- .../src/Org.OpenAPITools/Model/Category.cs | 12 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 14 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 8 +- .../Model/ComplexQuadrilateral.cs | 10 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 6 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 8 +- .../Model/DeprecatedObject.cs | 8 +- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 26 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 14 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 ++--- .../Model/EquilateralTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/File.cs | 8 +- .../Model/FileSchemaTestClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Foo.cs | 8 +- .../Model/FooGetDefaultResponse.cs | 8 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 108 ++++---- .../src/Org.OpenAPITools/Model/Fruit.cs | 10 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 4 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 16 +- .../Model/GrandparentAnimal.cs | 6 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 14 +- .../Model/HealthCheckResult.cs | 8 +- .../Model/IsoscelesTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/List.cs | 8 +- .../Model/LiteralStringClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 10 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 26 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 26 +- .../Model/Model200Response.cs | 14 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 24 +- ...cationtestGetElementsV1ResponseMPayload.cs | 10 +- .../Org.OpenAPITools/Model/NullableClass.cs | 74 +++--- .../Model/NullableGuidClass.cs | 8 +- .../Org.OpenAPITools/Model/NullableShape.cs | 8 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 8 +- .../Model/ObjectWithDeprecatedFields.cs | 26 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 4 +- .../src/Org.OpenAPITools/Model/Order.cs | 38 +-- .../Org.OpenAPITools/Model/OuterComposite.cs | 20 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 4 +- .../src/Org.OpenAPITools/Model/Pet.cs | 34 +-- .../src/Org.OpenAPITools/Model/Pig.cs | 8 +- .../Model/PolymorphicProperty.cs | 8 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 8 +- .../Model/QuadrilateralInterface.cs | 6 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 14 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 230 +++++++++--------- .../src/Org.OpenAPITools/Model/Return.cs | 8 +- .../Model/RolesReportsHash.cs | 14 +- .../Model/RolesReportsHashRole.cs | 8 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/Shape.cs | 8 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 8 +- .../Model/SimpleQuadrilateral.cs | 10 +- .../Model/SpecialModelName.cs | 14 +- .../src/Org.OpenAPITools/Model/Tag.cs | 14 +- .../Model/TestCollectionEndingWithWordList.cs | 8 +- .../TestCollectionEndingWithWordListObject.cs | 8 +- ...lineFreeformAdditionalPropertiesRequest.cs | 8 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 10 +- .../Model/TriangleInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/User.cs | 74 +++--- .../src/Org.OpenAPITools/Model/Whale.cs | 18 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 12 +- .../Model/ZeroBasedEnumClass.cs | 8 +- .../src/Org.OpenAPITools/Model/Adult.cs | 14 +- .../src/Org.OpenAPITools/Model/Child.cs | 20 +- .../src/Org.OpenAPITools/Model/Person.cs | 20 +- .../src/Org.OpenAPITools/Model/Apple.cs | 8 +- .../src/Org.OpenAPITools/Model/Banana.cs | 8 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 16 +- .../src/Org.OpenAPITools/Model/Apple.cs | 8 +- .../src/Org.OpenAPITools/Model/Banana.cs | 8 +- .../src/Org.OpenAPITools/Model/Fruit.cs | 10 +- .../src/Org.OpenAPITools/Model/Activity.cs | 8 +- .../ActivityOutputElementRepresentation.cs | 14 +- .../Model/AdditionalPropertiesClass.cs | 50 ++-- .../src/Org.OpenAPITools/Model/Animal.cs | 12 +- .../src/Org.OpenAPITools/Model/ApiResponse.cs | 20 +- .../src/Org.OpenAPITools/Model/Apple.cs | 20 +- .../src/Org.OpenAPITools/Model/AppleReq.cs | 12 +- .../Model/ArrayOfArrayOfNumberOnly.cs | 8 +- .../Model/ArrayOfNumberOnly.cs | 8 +- .../src/Org.OpenAPITools/Model/ArrayTest.cs | 20 +- .../src/Org.OpenAPITools/Model/Banana.cs | 8 +- .../src/Org.OpenAPITools/Model/BananaReq.cs | 12 +- .../src/Org.OpenAPITools/Model/BasquePig.cs | 6 +- .../Org.OpenAPITools/Model/Capitalization.cs | 38 +-- .../src/Org.OpenAPITools/Model/Cat.cs | 12 +- .../src/Org.OpenAPITools/Model/Category.cs | 12 +- .../src/Org.OpenAPITools/Model/ChildCat.cs | 14 +- .../src/Org.OpenAPITools/Model/ClassModel.cs | 8 +- .../Model/ComplexQuadrilateral.cs | 10 +- .../src/Org.OpenAPITools/Model/DanishPig.cs | 6 +- .../Org.OpenAPITools/Model/DateOnlyClass.cs | 8 +- .../Model/DeprecatedObject.cs | 8 +- .../src/Org.OpenAPITools/Model/Dog.cs | 12 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 26 +- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 14 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 ++--- .../Model/EquilateralTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/File.cs | 8 +- .../Model/FileSchemaTestClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Foo.cs | 8 +- .../Model/FooGetDefaultResponse.cs | 8 +- .../src/Org.OpenAPITools/Model/FormatTest.cs | 108 ++++---- .../src/Org.OpenAPITools/Model/Fruit.cs | 10 +- .../src/Org.OpenAPITools/Model/FruitReq.cs | 4 +- .../src/Org.OpenAPITools/Model/GmFruit.cs | 16 +- .../Model/GrandparentAnimal.cs | 6 +- .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 14 +- .../Model/HealthCheckResult.cs | 8 +- .../Model/IsoscelesTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/List.cs | 8 +- .../Model/LiteralStringClass.cs | 14 +- .../src/Org.OpenAPITools/Model/Mammal.cs | 10 +- .../src/Org.OpenAPITools/Model/MapTest.cs | 26 +- ...dPropertiesAndAdditionalPropertiesClass.cs | 26 +- .../Model/Model200Response.cs | 14 +- .../src/Org.OpenAPITools/Model/ModelClient.cs | 8 +- .../src/Org.OpenAPITools/Model/Name.cs | 24 +- ...cationtestGetElementsV1ResponseMPayload.cs | 10 +- .../Org.OpenAPITools/Model/NullableClass.cs | 74 +++--- .../Model/NullableGuidClass.cs | 8 +- .../Org.OpenAPITools/Model/NullableShape.cs | 8 +- .../src/Org.OpenAPITools/Model/NumberOnly.cs | 8 +- .../Model/ObjectWithDeprecatedFields.cs | 26 +- .../src/Org.OpenAPITools/Model/OneOfString.cs | 4 +- .../src/Org.OpenAPITools/Model/Order.cs | 38 +-- .../Org.OpenAPITools/Model/OuterComposite.cs | 20 +- .../src/Org.OpenAPITools/Model/ParentPet.cs | 4 +- .../src/Org.OpenAPITools/Model/Pet.cs | 34 +-- .../src/Org.OpenAPITools/Model/Pig.cs | 8 +- .../Model/PolymorphicProperty.cs | 8 +- .../Org.OpenAPITools/Model/Quadrilateral.cs | 8 +- .../Model/QuadrilateralInterface.cs | 6 +- .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 14 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 230 +++++++++--------- .../src/Org.OpenAPITools/Model/Return.cs | 8 +- .../Model/RolesReportsHash.cs | 14 +- .../Model/RolesReportsHashRole.cs | 8 +- .../Org.OpenAPITools/Model/ScaleneTriangle.cs | 10 +- .../src/Org.OpenAPITools/Model/Shape.cs | 8 +- .../Org.OpenAPITools/Model/ShapeInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/ShapeOrNull.cs | 8 +- .../Model/SimpleQuadrilateral.cs | 10 +- .../Model/SpecialModelName.cs | 14 +- .../src/Org.OpenAPITools/Model/Tag.cs | 14 +- .../Model/TestCollectionEndingWithWordList.cs | 8 +- .../TestCollectionEndingWithWordListObject.cs | 8 +- ...lineFreeformAdditionalPropertiesRequest.cs | 8 +- .../src/Org.OpenAPITools/Model/Triangle.cs | 10 +- .../Model/TriangleInterface.cs | 6 +- .../src/Org.OpenAPITools/Model/User.cs | 74 +++--- .../src/Org.OpenAPITools/Model/Whale.cs | 18 +- .../src/Org.OpenAPITools/Model/Zebra.cs | 12 +- .../Model/ZeroBasedEnumClass.cs | 8 +- 343 files changed, 3173 insertions(+), 3173 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache index 95cc8c3a1419..4517e15ca317 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 @@ -280,7 +280,7 @@ {{#model.hasDiscriminatorWithNonEmptyMapping}} {{#mappedModels}} if ({{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // c + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{model.classname}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{#-last}} throw new JsonException(); @@ -299,13 +299,13 @@ {{/-last}} {{/required}} - return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // a + return new {{classname}}({{#lambda.joinWithComma}}{{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{baseType}}{{/lambda.camelcase_param}}ParsedValue{{#required}}.Value{{^isNullable}}{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}.Value{{nrt!}}{{^isNullable}}{{#vendorExtensions.x-is-value-type}}.Value{{nrt!}}{{/vendorExtensions.x-is-value-type}}{{/isNullable}}{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{/composedSchemas.oneOf}} {{^model.discriminator}} {{#composedSchemas}} {{#oneOf}} if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}} != null) - return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); // b + return new {{classname}}({{#lambda.joinWithComma}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{#model.composedSchemas.anyOf}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#vendorExtensions.x-is-value-type}}{{^isNullable}}.Value{{/isNullable}}{{/vendorExtensions.x-is-value-type}} {{/model.composedSchemas.anyOf}}{{#allVars}}{{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}{{#required}}ParsedValue{{/required}} {{/allVars}}{{/lambda.joinWithComma}}); {{#-last}} throw new JsonException(); @@ -383,7 +383,7 @@ {{^isEnum}} {{^isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); // 1 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -394,7 +394,7 @@ {{/isString}} {{#isBoolean}} {{#lambda.copy}} - writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 2 + writer.WriteBoolean("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -403,7 +403,7 @@ {{^isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 3 + writer.WriteNumber("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -412,7 +412,7 @@ {{/isEnum}} {{#isDate}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 4 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -420,7 +420,7 @@ {{/isDate}} {{#isDateTime}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); // 5 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}.ToString({{name}}Format)); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -429,7 +429,7 @@ {{#isEnum}} {{#isNumeric}} {{#lambda.copy}} - writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); // 6 + writer.WriteNumber("{{baseName}}", {{#isInnerEnum}}{{classname}}.{{/isInnerEnum}}{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}})); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -438,7 +438,7 @@ {{^isMap}} {{^isNumeric}} {{#isInnerEnum}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}{{nrt!}}.Value{{/isNullable}}{{/required}}); // 7 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{classname}}.{{{datatypeWithEnum}}}ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}{{nrt!}}.Value{{/isNullable}}{{/required}}); if ({{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue != null) writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue); else @@ -451,11 +451,11 @@ {{/lambda.copy}} {{#required}} {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) // 8 + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} == null) writer.WriteNull("{{baseName}}"); else { - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); // 8a + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}.Value); {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -474,7 +474,7 @@ } {{/isNullable}} {{^isNullable}} - var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); // 9 + var {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}RawValue = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}); {{#allowableValues}} {{#enumVars}} {{#-first}} @@ -491,11 +491,11 @@ {{/required}} {{^required}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 10 + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option{{nrt!}}.Value != null) // 10 a + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option{{nrt!}}.Value != null) { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value{{nrt!}}.Value); // 10 c + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value{{nrt!}}.Value); writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } else @@ -503,7 +503,7 @@ {{/isNullable}} {{^isNullable}} { - var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{nrt!}}.Value); // 10 b + var {{#lambda.pasteLine}}{{/lambda.pasteLine}} = {{{datatypeWithEnum}}}ValueConverter.ToJsonValue({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{nrt!}}.Value); writer.{{#lambda.first}}{{#allowableValues}}{{#enumVars}}{{#isString}}WriteString {{/isString}}{{^isString}}WriteNumber {{/isString}}{{/enumVars}}{{/allowableValues}}{{/lambda.first}}("{{baseName}}", {{#lambda.pasteLine}}{{/lambda.pasteLine}}); } {{/isNullable}} @@ -514,7 +514,7 @@ {{/isEnum}} {{#isUuid}} {{#lambda.copy}} - writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); // 11 + writer.WriteString("{{baseName}}", {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}{{^required}}Option.Value{{#vendorExtensions.x-is-value-type}}{{nrt!}}.Value{{/vendorExtensions.x-is-value-type}}{{/required}}{{#required}}{{#isNullable}}.Value{{/isNullable}}{{/required}}); {{/lambda.copy}} {{#lambda.indent3}} {{>WriteProperty}} @@ -529,7 +529,7 @@ {{^isDateTime}} {{#required}} {{#isNullable}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) // 12 + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}} != null) { writer.WritePropertyName("{{baseName}}"); JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); @@ -539,11 +539,11 @@ {{/isNullable}} {{^isNullable}} writer.WritePropertyName("{{baseName}}"); - JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); // 13 + JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); {{/isNullable}} {{/required}} {{^required}} - if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) // 14 + if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) {{#isNullable}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value != null) { diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index 0975cf0785d1..bbc7b54df400 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -89,7 +89,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] - public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option a + public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} /// @@ -105,7 +105,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // a + public {{#isNew}}new {{/isNew}}{{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} {{/isEnum}} {{/vars}} @@ -116,7 +116,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] - public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option b + public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} /// @@ -129,7 +129,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // b + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option; } {{^isReadOnly}}set { this.{{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} {{/vendorExtensions.x-duplicated-data-type}} {{/composedSchemas.anyOf}} @@ -158,7 +158,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] - public new Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option c + public new Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} /// @@ -172,7 +172,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // c + public new {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this.{{name}}Option } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} {{/isNew}} {{/isInherited}} @@ -182,7 +182,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] - public Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} // option d + public Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} /// @@ -196,7 +196,7 @@ {{#deprecated}} [Obsolete] {{/deprecated}} - public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} // d + public {{{datatypeWithEnum}}}{{#lambda.first}}{{#isNullable}}{{>NullConditionalProperty}} {{/isNullable}}{{^required}}{{nrt?}}{{^nrt}}{{#vendorExtensions.x-is-value-type}}?{{/vendorExtensions.x-is-value-type}}{{/nrt}} {{/required}}{{/lambda.first}} {{name}} {{#required}}{ get; {{^isReadOnly}}set; {{/isReadOnly}}}{{/required}}{{^required}}{ get { return this. {{name}}Option; } {{^isReadOnly}}set { this.{{name}}Option = new{{^net70OrLater}} Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}>{{/net70OrLater}}(value); } {{/isReadOnly}}}{{/required}} {{/isInherited}} {{/isEnum}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index 18c297abdd6d..ac83bb614c64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -49,13 +49,13 @@ public Activity(Option [JsonIgnore] - public Option>?> ActivityOutputsOption { get; private set; } // option d + public Option>?> ActivityOutputsOption { get; private set; } /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d + public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (activityOutputs.IsSet && activityOutputs.Value == null) throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); // a + return new Activity(activityOutputs); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - if (activity.ActivityOutputsOption.IsSet) // 14 + if (activity.ActivityOutputsOption.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index cfd5a73d393e..89ee64c5eeb9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -51,25 +51,25 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop1 /// [JsonIgnore] - public Option Prop1Option { get; private set; } // option d + public Option Prop1Option { get; private set; } /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } /// /// Used to track the state of Prop2 /// [JsonIgnore] - public Option Prop2Option { get; private set; } // option d + public Option Prop2Option { get; private set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d + public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 if (prop2.IsSet && prop2.Value == null) throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); // a + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -196,9 +196,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); if (activityOutputElementRepresentation.Prop1Option.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + if (activityOutputElementRepresentation.Prop2Option.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index 85cb4d22d57b..c3ad7987b21c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -63,98 +63,98 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] - public Option EmptyMapOption { get; private set; } // option d + public Option EmptyMapOption { get; private set; } /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } /// /// Used to track the state of MapOfMapProperty /// [JsonIgnore] - public Option>?> MapOfMapPropertyOption { get; private set; } // option d + public Option>?> MapOfMapPropertyOption { get; private set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } /// /// Used to track the state of MapProperty /// [JsonIgnore] - public Option?> MapPropertyOption { get; private set; } // option d + public Option?> MapPropertyOption { get; private set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 /// [JsonIgnore] - public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesString /// [JsonIgnore] - public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } /// /// Used to track the state of Anytype1 /// [JsonIgnore] - public Option Anytype1Option { get; private set; } // option d + public Option Anytype1Option { get; private set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } /// /// Gets or Sets additional properties @@ -299,7 +299,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -347,28 +347,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + if (additionalPropertiesClass.EmptyMapOption.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapPropertyOption.IsSet) writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { writer.WritePropertyName("anytype_1"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index fd9ab8f8951f..b5fd1caf1052 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -51,19 +51,19 @@ public Animal(string className, Option color = default) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Gets or Sets additional properties @@ -168,7 +168,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className.Value!, color); // a + return new Animal(className.Value!, color); } /// @@ -201,10 +201,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.ColorOption.IsSet && animal.Color == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); // 1 + writer.WriteString("className", animal.ClassName); if (animal.ColorOption.IsSet) - writer.WriteString("color", animal.Color); // 1 + writer.WriteString("color", animal.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index 4882c7a0c88a..2ab7a6609859 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -53,37 +53,37 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Code /// [JsonIgnore] - public Option CodeOption { get; private set; } // option d + public Option CodeOption { get; private set; } /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } /// /// Used to track the state of Message /// [JsonIgnore] - public Option MessageOption { get; private set; } // option d + public Option MessageOption { get; private set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } /// /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option d + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets additional properties @@ -184,7 +184,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code, message, type); // a + return new ApiResponse(code, message, type); } /// @@ -218,13 +218,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); if (apiResponse.CodeOption.IsSet) - writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); if (apiResponse.MessageOption.IsSet) - writer.WriteString("message", apiResponse.Message); // 1 + writer.WriteString("message", apiResponse.Message); if (apiResponse.TypeOption.IsSet) - writer.WriteString("type", apiResponse.Type); // 1 + writer.WriteString("type", apiResponse.Type); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index e0f3322620b0..6848784396a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -53,37 +53,37 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of ColorCode /// [JsonIgnore] - public Option ColorCodeOption { get; private set; } // option d + public Option ColorCodeOption { get; private set; } /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } /// /// Used to track the state of Cultivar /// [JsonIgnore] - public Option CultivarOption { get; private set; } // option d + public Option CultivarOption { get; private set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } /// /// Used to track the state of Origin /// [JsonIgnore] - public Option OriginOption { get; private set; } // option d + public Option OriginOption { get; private set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d + public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } /// /// Gets or Sets additional properties @@ -213,7 +213,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (origin.IsSet && origin.Value == null) throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); // a + return new Apple(colorCode, cultivar, origin); } /// @@ -250,13 +250,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); if (apple.ColorCodeOption.IsSet) - writer.WriteString("color_code", apple.ColorCode); // 1 + writer.WriteString("color_code", apple.ColorCode); if (apple.CultivarOption.IsSet) - writer.WriteString("cultivar", apple.Cultivar); // 1 + writer.WriteString("cultivar", apple.Cultivar); if (apple.OriginOption.IsSet) - writer.WriteString("origin", apple.Origin); // 1 + writer.WriteString("origin", apple.Origin); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index 2896370f2d2d..9663e71bc61c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -51,19 +51,19 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } // d + public string Cultivar { get; set; } /// /// Used to track the state of Mealy /// [JsonIgnore] - public Option MealyOption { get; private set; } // option d + public Option MealyOption { get; private set; } /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } /// /// Returns the string presentation of the object @@ -152,7 +152,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (mealy.IsSet && mealy.Value == null) throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar.Value!, mealy); // a + return new AppleReq(cultivar.Value!, mealy); } /// @@ -182,10 +182,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); // 1 + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) - writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index 2295508e2437..04a75c0eaa76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -49,13 +49,13 @@ public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] - public Option>?> ArrayArrayNumberOption { get; private set; } // option d + public Option>?> ArrayArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d + public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 5be3d1702d71..54e4a1528c3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -49,13 +49,13 @@ public ArrayOfNumberOnly(Option?> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] - public Option?> ArrayNumberOption { get; private set; } // option d + public Option?> ArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d + public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t if (arrayNumber.IsSet && arrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); // a + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 735e45a1a769..7f6b9b4186fb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -53,37 +53,37 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] - public Option>?> ArrayArrayOfIntegerOption { get; private set; } // option d + public Option>?> ArrayArrayOfIntegerOption { get; private set; } /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } /// /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] - public Option>?> ArrayArrayOfModelOption { get; private set; } // option d + public Option>?> ArrayArrayOfModelOption { get; private set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } /// /// Used to track the state of ArrayOfString /// [JsonIgnore] - public Option?> ArrayOfStringOption { get; private set; } // option d + public Option?> ArrayOfStringOption { get; private set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d + public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -186,7 +186,7 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (arrayOfString.IsSet && arrayOfString.Value == null) throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -222,13 +222,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfModelOption.IsSet) writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfStringOption.IsSet) // 14 + if (arrayTest.ArrayOfStringOption.IsSet) writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs index 03e94b048c72..6cd9dc70708a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs @@ -49,13 +49,13 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] - public Option LengthCmOption { get; private set; } // option d + public Option LengthCmOption { get; private set; } /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (lengthCm.IsSet && lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm); // a + return new Banana(lengthCm); } /// @@ -168,7 +168,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.LengthCmOption.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index 5f55a0f1f59b..a0633ea3256e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -51,19 +51,19 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } // d + public decimal LengthCm { get; set; } /// /// Used to track the state of Sweet /// [JsonIgnore] - public Option SweetOption { get; private set; } // option d + public Option SweetOption { get; private set; } /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } /// /// Returns the string presentation of the object @@ -153,7 +153,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (sweet.IsSet && sweet.Value == null) throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value!.Value!, sweet); // a + return new BananaReq(lengthCm.Value!.Value!, sweet); } /// @@ -180,10 +180,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) - writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs index 3f96b5db6715..f97e58808850 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BasquePig.cs @@ -49,7 +49,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - return new BasquePig(className.Value!); // a + return new BasquePig(className.Value!); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); // 1 + writer.WriteString("className", basquePig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index d3c940c19591..0ddd6c8f3361 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -59,74 +59,74 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of ATT_NAME /// [JsonIgnore] - public Option ATT_NAMEOption { get; private set; } // option d + public Option ATT_NAMEOption { get; private set; } /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } /// /// Used to track the state of CapitalCamel /// [JsonIgnore] - public Option CapitalCamelOption { get; private set; } // option d + public Option CapitalCamelOption { get; private set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } /// /// Used to track the state of CapitalSnake /// [JsonIgnore] - public Option CapitalSnakeOption { get; private set; } // option d + public Option CapitalSnakeOption { get; private set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } /// /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] - public Option SCAETHFlowPointsOption { get; private set; } // option d + public Option SCAETHFlowPointsOption { get; private set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } /// /// Used to track the state of SmallCamel /// [JsonIgnore] - public Option SmallCamelOption { get; private set; } // option d + public Option SmallCamelOption { get; private set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } /// /// Used to track the state of SmallSnake /// [JsonIgnore] - public Option SmallSnakeOption { get; private set; } // option d + public Option SmallSnakeOption { get; private set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d + public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } /// /// Gets or Sets additional properties @@ -250,7 +250,7 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type if (smallSnake.IsSet && smallSnake.Value == null) throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -296,22 +296,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); if (capitalization.ATT_NAMEOption.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); if (capitalization.CapitalCamelOption.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); if (capitalization.CapitalSnakeOption.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); if (capitalization.SCAETHFlowPointsOption.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); if (capitalization.SmallCamelOption.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + writer.WriteString("smallCamel", capitalization.SmallCamel); if (capitalization.SmallSnakeOption.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 + writer.WriteString("small_Snake", capitalization.SmallSnake); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index 5e477baaeeac..d19644f68a36 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -51,13 +51,13 @@ public Cat(string className, Option declawed = default, Option c /// Used to track the state of Declawed /// [JsonIgnore] - public Option DeclawedOption { get; private set; } // option d + public Option DeclawedOption { get; private set; } /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } /// /// Returns the string presentation of the object @@ -143,7 +143,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value!, declawed, color); // a + return new Cat(className.Value!, declawed, color); } /// @@ -176,13 +176,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.ColorOption.IsSet && cat.Color == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); // 1 + writer.WriteString("className", cat.ClassName); if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); if (cat.ColorOption.IsSet) - writer.WriteString("color", cat.Color); // 1 + writer.WriteString("color", cat.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index e330646b2b6e..307da6102a9a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -51,19 +51,19 @@ public Category(string name = @"default-name", Option id = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value!, id); // a + return new Category(name.Value!, id); } /// @@ -189,10 +189,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); // 1 + writer.WriteString("name", category.Name); if (category.IdOption.IsSet) - writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", category.IdOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index e9c49bb68d44..0d1f07c815ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -103,25 +103,25 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] - public new Option PetTypeOption { get; private set; } // option a + public new Option PetTypeOption { get; private set; } /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Returns the string presentation of the object @@ -199,7 +199,7 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType); // a + return new ChildCat(name, petType); } /// @@ -230,9 +230,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); if (childCat.NameOption.IsSet) - writer.WriteString("name", childCat.Name); // 1 + writer.WriteString("name", childCat.Name); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index 6d5349408bc3..ea3eb9058b94 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -49,13 +49,13 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (varClass.IsSet && varClass.Value == null) throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); // a + return new ClassModel(varClass); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClassOption.IsSet) - writer.WriteString("_class", classModel.VarClass); // 1 + writer.WriteString("_class", classModel.VarClass); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs index 924c05c48b31..7aac7ba92408 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ComplexQuadrilateral.cs @@ -51,13 +51,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -155,7 +155,7 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); } /// @@ -188,9 +188,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs index e24a2a132925..312da5259bf0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DanishPig.cs @@ -49,7 +49,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - return new DanishPig(className.Value!); // a + return new DanishPig(className.Value!); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); // 1 + writer.WriteString("className", danishPig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index c1755d3f3f01..1e65528d26cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -49,14 +49,14 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] - public Option DateOnlyPropertyOption { get; private set; } // option d + public Option DateOnlyPropertyOption { get; private set; } /// /// Gets or Sets DateOnlyProperty /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -146,7 +146,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty); // a + return new DateOnlyClass(dateOnlyProperty); } /// @@ -174,7 +174,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyPropertyOption.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index 26e52607c32e..76e33fbcd2cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -49,13 +49,13 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); // a + return new DeprecatedObject(name); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.NameOption.IsSet) - writer.WriteString("name", deprecatedObject.Name); // 1 + writer.WriteString("name", deprecatedObject.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index 3b14f4f5a578..ac96aef36d98 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -51,13 +51,13 @@ public Dog(string className, Option breed = default, Option co /// Used to track the state of Breed /// [JsonIgnore] - public Option BreedOption { get; private set; } // option d + public Option BreedOption { get; private set; } /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d + public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } /// /// Returns the string presentation of the object @@ -142,7 +142,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(className.Value!, breed, color); // a + return new Dog(className.Value!, breed, color); } /// @@ -178,13 +178,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.ColorOption.IsSet && dog.Color == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); // 1 + writer.WriteString("className", dog.ClassName); if (dog.BreedOption.IsSet) - writer.WriteString("breed", dog.Breed); // 1 + writer.WriteString("breed", dog.Breed); if (dog.ColorOption.IsSet) - writer.WriteString("color", dog.Color); // 1 + writer.WriteString("color", dog.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index ce32e69af682..b57e698f27b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -55,49 +55,49 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of MainShape /// [JsonIgnore] - public Option MainShapeOption { get; private set; } // option d + public Option MainShapeOption { get; private set; } /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } /// /// Used to track the state of Shapes /// [JsonIgnore] - public Option?> ShapesOption { get; private set; } // option d + public Option?> ShapesOption { get; private set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } /// /// Used to track the state of NullableShape /// [JsonIgnore] - public Option NullableShapeOption { get; private set; } // option d + public Option NullableShapeOption { get; private set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } /// /// Used to track the state of ShapeOrNull /// [JsonIgnore] - public Option ShapeOrNullOption { get; private set; } // option d + public Option ShapeOrNullOption { get; private set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d + public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } /// /// Gets or Sets additional properties @@ -214,7 +214,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -247,13 +247,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri if (drawing.ShapesOption.IsSet && drawing.Shapes == null) throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - if (drawing.MainShapeOption.IsSet) // 14 + if (drawing.MainShapeOption.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.ShapesOption.IsSet) // 14 + if (drawing.ShapesOption.IsSet) writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { writer.WritePropertyName("nullableShape"); @@ -261,7 +261,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.IsSet) if (drawing.ShapeOrNullOption.Value != null) { writer.WritePropertyName("shapeOrNull"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index a911172aa949..2b70ca9f31dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -183,25 +183,25 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] - public Option JustSymbolOption { get; private set; } // option a + public Option JustSymbolOption { get; private set; } /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } /// /// Used to track the state of ArrayEnum /// [JsonIgnore] - public Option?> ArrayEnumOption { get; private set; } // option d + public Option?> ArrayEnumOption { get; private set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d + public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -296,7 +296,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justSymbol.IsSet && justSymbol.Value == null) throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol); // a + return new EnumArrays(arrayEnum, justSymbol); } /// @@ -326,10 +326,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - if (enumArrays.ArrayEnumOption.IsSet) // 14 + if (enumArrays.ArrayEnumOption.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index 15fe3d73899c..fe5d3aef86c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -215,7 +215,7 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets EnumStringRequired /// [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Defines EnumInteger @@ -280,13 +280,13 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] - public Option EnumIntegerOption { get; private set; } // option a + public Option EnumIntegerOption { get; private set; } /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } /// /// Defines EnumIntegerOnly @@ -351,13 +351,13 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] - public Option EnumIntegerOnlyOption { get; private set; } // option a + public Option EnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } /// /// Defines EnumNumber @@ -429,13 +429,13 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] - public Option EnumNumberOption { get; private set; } // option a + public Option EnumNumberOption { get; private set; } /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } /// /// Defines EnumString @@ -591,61 +591,61 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] - public Option EnumStringOption { get; private set; } // option a + public Option EnumStringOption { get; private set; } /// /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } /// /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] - public Option OuterEnumDefaultValueOption { get; private set; } // option a + public Option OuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnumInteger /// [JsonIgnore] - public Option OuterEnumIntegerOption { get; private set; } // option a + public Option OuterEnumIntegerOption { get; private set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } /// /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] - public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a + public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnum /// [JsonIgnore] - public Option OuterEnumOption { get; private set; } // option a + public Option OuterEnumOption { get; private set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -808,7 +808,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); } /// @@ -835,46 +835,46 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); if (enumTest.EnumIntegerOption.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); if (enumTest.EnumIntegerOnlyOption.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); if (enumTest.EnumNumberOption.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else writer.WriteNull("enum_string"); - if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumDefaultValueOption.IsSet) { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); } - if (enumTest.OuterEnumIntegerOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerOption.IsSet) { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } - if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) // 10 - if (enumTest.OuterEnumOption!.Value != null) // 10 a + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); writer.WriteString("outerEnum", outerEnumRawValue); } else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs index 35a60c1e8316..ef87cf48dfdd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EquilateralTriangle.cs @@ -51,13 +51,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -155,7 +155,7 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -188,9 +188,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index 20c7fdfb332e..48e4008510a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -49,14 +49,14 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] - public Option SourceURIOption { get; private set; } // option d + public Option SourceURIOption { get; private set; } /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d + public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (sourceURI.IsSet && sourceURI.Value == null) throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); // a + return new File(sourceURI); } /// @@ -171,7 +171,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURIOption.IsSet) - writer.WriteString("sourceURI", file.SourceURI); // 1 + writer.WriteString("sourceURI", file.SourceURI); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index 930cbfa306e6..80007f7efb76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -51,25 +51,25 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of File /// [JsonIgnore] - public Option FileOption { get; private set; } // option d + public Option FileOption { get; private set; } /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } /// /// Used to track the state of Files /// [JsonIgnore] - public Option?> FilesOption { get; private set; } // option d + public Option?> FilesOption { get; private set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d + public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } /// /// Gets or Sets additional properties @@ -163,7 +163,7 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type if (files.IsSet && files.Value == null) throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); // a + return new FileSchemaTestClass(file, files); } /// @@ -196,10 +196,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - if (fileSchemaTestClass.FileOption.IsSet) // 14 + if (fileSchemaTestClass.FileOption.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.FilesOption.IsSet) // 14 + if (fileSchemaTestClass.FilesOption.IsSet) writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index 01cf7952b547..faf6cada2867 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -49,13 +49,13 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; private set; } // option d + public Option BarOption { get; private set; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d + public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (bar.IsSet && bar.Value == null) throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); // a + return new Foo(bar); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.BarOption.IsSet) - writer.WriteString("bar", foo.Bar); // 1 + writer.WriteString("bar", foo.Bar); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index 5b58204da9f4..ea91c011b9d5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -49,13 +49,13 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); // a + return new FooGetDefaultResponse(varString); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + if (fooGetDefaultResponse.VarStringOption.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index 0bd67c8b5059..b73edfd78d6a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -85,211 +85,211 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } // d + public byte[] VarByte { get; set; } /// /// Gets or Sets Date /// /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } // d + public DateTime Date { get; set; } /// /// Gets or Sets Number /// [JsonPropertyName("number")] - public decimal Number { get; set; } // d + public decimal Number { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } // d + public string Password { get; set; } /// /// Used to track the state of Binary /// [JsonIgnore] - public Option BinaryOption { get; private set; } // option d + public Option BinaryOption { get; private set; } /// /// Gets or Sets Binary /// [JsonPropertyName("binary")] - public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } /// /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of VarDecimal /// [JsonIgnore] - public Option VarDecimalOption { get; private set; } // option d + public Option VarDecimalOption { get; private set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } /// /// Used to track the state of VarDouble /// [JsonIgnore] - public Option VarDoubleOption { get; private set; } // option d + public Option VarDoubleOption { get; private set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } /// /// Used to track the state of VarFloat /// [JsonIgnore] - public Option VarFloatOption { get; private set; } // option d + public Option VarFloatOption { get; private set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } /// /// Used to track the state of Int32 /// [JsonIgnore] - public Option Int32Option { get; private set; } // option d + public Option Int32Option { get; private set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } /// /// Used to track the state of Int64 /// [JsonIgnore] - public Option Int64Option { get; private set; } // option d + public Option Int64Option { get; private set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } /// /// Used to track the state of Integer /// [JsonIgnore] - public Option IntegerOption { get; private set; } // option d + public Option IntegerOption { get; private set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } /// /// Used to track the state of PatternWithBackslash /// [JsonIgnore] - public Option PatternWithBackslashOption { get; private set; } // option d + public Option PatternWithBackslashOption { get; private set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } /// /// Used to track the state of PatternWithDigits /// [JsonIgnore] - public Option PatternWithDigitsOption { get; private set; } // option d + public Option PatternWithDigitsOption { get; private set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } /// /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] - public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d + public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } /// /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Used to track the state of UnsignedInteger /// [JsonIgnore] - public Option UnsignedIntegerOption { get; private set; } // option d + public Option UnsignedIntegerOption { get; private set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } /// /// Used to track the state of UnsignedLong /// [JsonIgnore] - public Option UnsignedLongOption { get; private set; } // option d + public Option UnsignedLongOption { get; private set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -677,7 +677,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); } /// @@ -726,57 +726,57 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); // 3 + writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); // 1 + writer.WriteString("password", formatTest.Password); - if (formatTest.BinaryOption.IsSet) // 14 + if (formatTest.BinaryOption.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTimeOption.IsSet) - writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimalOption.IsSet) // 14 + if (formatTest.VarDecimalOption.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDoubleOption.IsSet) - writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); if (formatTest.VarFloatOption.IsSet) - writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); if (formatTest.Int32Option.IsSet) - writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); if (formatTest.Int64Option.IsSet) - writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); if (formatTest.IntegerOption.IsSet) - writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); if (formatTest.PatternWithBackslashOption.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); if (formatTest.PatternWithDigitsOption.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); if (formatTest.VarStringOption.IsSet) - writer.WriteString("string", formatTest.VarString); // 1 + writer.WriteString("string", formatTest.VarString); if (formatTest.UnsignedIntegerOption.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); if (formatTest.UnsignedLongOption.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); if (formatTest.UuidOption.IsSet) - writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index e62a3ac5f327..82d85bae189f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -72,13 +72,13 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -178,10 +178,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); // b + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, color); // b + return new Fruit(banana, color); throw new JsonException(); } @@ -214,7 +214,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs index d135e0fd2550..797f263735e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FruitReq.cs @@ -153,10 +153,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); // b + return new FruitReq(appleReq); if (bananaReq != null) - return new FruitReq(bananaReq); // b + return new FruitReq(bananaReq); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index d3252c6ce581..ec0243d528e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -52,35 +52,35 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Apple /// [JsonIgnore] - public Option AppleOption { get; private set; } // option b + public Option AppleOption { get; private set; } /// /// Gets or Sets Apple /// - public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } /// /// Used to track the state of Banana /// [JsonIgnore] - public Option BananaOption { get; private set; } // option b + public Option BananaOption { get; private set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -186,7 +186,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve ? default : new Option(banana); - return new GmFruit(appleParsedValue, bananaParsedValue, color); // a + return new GmFruit(appleParsedValue, bananaParsedValue, color); } /// @@ -229,7 +229,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.ColorOption.IsSet) - writer.WriteString("color", gmFruit.Color); // 1 + writer.WriteString("color", gmFruit.Color); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs index c7c370ed3723..ff6399cd2fed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GrandparentAnimal.cs @@ -49,7 +49,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } // d + public string PetType { get; set; } /// /// Gets or Sets additional properties @@ -146,7 +146,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - return new GrandparentAnimal(petType.Value!); // a + return new GrandparentAnimal(petType.Value!); } /// @@ -176,7 +176,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 + writer.WriteString("pet_type", grandparentAnimal.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index ff771e015451..bd65c2c64c67 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -51,25 +51,25 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } } // d + public string? Bar { get { return this. BarOption; } } /// /// Used to track the state of Foo /// [JsonIgnore] - public Option FooOption { get; } // option d + public Option FooOption { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string? Foo { get { return this. FooOption; } } // d + public string? Foo { get { return this. FooOption; } } /// /// Gets or Sets additional properties @@ -202,7 +202,7 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ if (foo.IsSet && foo.Value == null) throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); // a + return new HasOnlyReadOnly(bar, foo); } /// @@ -236,10 +236,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); if (hasOnlyReadOnly.BarOption.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + writer.WriteString("bar", hasOnlyReadOnly.Bar); if (hasOnlyReadOnly.FooOption.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs index e529ef10adbb..a07fd2b1ba3f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs @@ -49,13 +49,13 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] - public Option NullableMessageOption { get; private set; } // option d + public Option NullableMessageOption { get; private set; } /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d + public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); // a + return new HealthCheckResult(nullableMessage); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessageOption.IsSet) if (healthCheckResult.NullableMessageOption.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs index 47ceb71759ad..90f931a85c55 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/IsoscelesTriangle.cs @@ -51,13 +51,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Returns the string presentation of the object @@ -148,7 +148,7 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -181,9 +181,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index 2883d97e3d68..83b717ea65c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -49,13 +49,13 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] - public Option Var123ListOption { get; private set; } // option d + public Option Var123ListOption { get; private set; } /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d + public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123List.IsSet && var123List.Value == null) throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); // a + return new List(var123List); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123ListOption.IsSet) - writer.WriteString("123-list", list.Var123List); // 1 + writer.WriteString("123-list", list.Var123List); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 941b4192f597..78cf4904c24b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -51,25 +51,25 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of EscapedLiteralString /// [JsonIgnore] - public Option EscapedLiteralStringOption { get; private set; } // option d + public Option EscapedLiteralStringOption { get; private set; } /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } /// /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] - public Option UnescapedLiteralStringOption { get; private set; } // option d + public Option UnescapedLiteralStringOption { get; private set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d + public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -161,7 +161,7 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -195,10 +195,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); if (literalStringClass.EscapedLiteralStringOption.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); if (literalStringClass.UnescapedLiteralStringOption.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs index ce4d38c3e0f4..676b1d08c139 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Mammal.cs @@ -89,7 +89,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -226,13 +226,13 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className.Value!); // c + return new Mammal(pig, className.Value!); if (whale != null) - return new Mammal(whale, className.Value!); // c + return new Mammal(whale, className.Value!); if (zebra != null) - return new Mammal(zebra, className.Value!); // c + return new Mammal(zebra, className.Value!); throw new JsonException(); } @@ -279,7 +279,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); // 1 + writer.WriteString("className", mammal.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index c8df4fb85b54..9cb9d292fc34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -121,49 +121,49 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of DirectMap /// [JsonIgnore] - public Option?> DirectMapOption { get; private set; } // option d + public Option?> DirectMapOption { get; private set; } /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } /// /// Used to track the state of IndirectMap /// [JsonIgnore] - public Option?> IndirectMapOption { get; private set; } // option d + public Option?> IndirectMapOption { get; private set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } /// /// Used to track the state of MapMapOfString /// [JsonIgnore] - public Option>?> MapMapOfStringOption { get; private set; } // option d + public Option>?> MapMapOfStringOption { get; private set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } /// /// Used to track the state of MapOfEnumString /// [JsonIgnore] - public Option?> MapOfEnumStringOption { get; private set; } // option d + public Option?> MapOfEnumStringOption { get; private set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d + public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -275,7 +275,7 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -314,16 +314,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - if (mapTest.DirectMapOption.IsSet) // 14 + if (mapTest.DirectMapOption.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMapOption.IsSet) // 14 + if (mapTest.IndirectMapOption.IsSet) writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfStringOption.IsSet) // 14 + if (mapTest.MapMapOfStringOption.IsSet) writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumStringOption.IsSet) // 14 + if (mapTest.MapOfEnumStringOption.IsSet) writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index fa5b73120769..8938a22cd971 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -55,49 +55,49 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of Map /// [JsonIgnore] - public Option?> MapOption { get; private set; } // option d + public Option?> MapOption { get; private set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Used to track the state of UuidWithPattern /// [JsonIgnore] - public Option UuidWithPatternOption { get; private set; } // option d + public Option UuidWithPatternOption { get; private set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } /// /// Gets or Sets additional properties @@ -221,7 +221,7 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); } /// @@ -252,16 +252,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index 301f26d8bfcd..5c1649330132 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -51,25 +51,25 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name); // a + return new Model200Response(varClass, name); } /// @@ -193,10 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); if (model200Response.VarClassOption.IsSet) - writer.WriteString("class", model200Response.VarClass); // 1 + writer.WriteString("class", model200Response.VarClass); if (model200Response.NameOption.IsSet) - writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index 6dcf22a39ed3..0df66d12d106 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -49,13 +49,13 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] - public Option VarClientOption { get; private set; } // option d + public Option VarClientOption { get; private set; } /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d + public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (varClient.IsSet && varClient.Value == null) throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); // a + return new ModelClient(varClient); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClientOption.IsSet) - writer.WriteString("client", modelClient.VarClient); // 1 + writer.WriteString("client", modelClient.VarClient); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index b90ab689c17d..06fab465d7be 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -55,43 +55,43 @@ public Name(int varName, Option property = default, Option snakeC /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } // d + public int VarName { get; set; } /// /// Used to track the state of Property /// [JsonIgnore] - public Option PropertyOption { get; private set; } // option d + public Option PropertyOption { get; private set; } /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } /// /// Used to track the state of SnakeCase /// [JsonIgnore] - public Option SnakeCaseOption { get; } // option d + public Option SnakeCaseOption { get; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + public int? SnakeCase { get { return this. SnakeCaseOption; } } /// /// Used to track the state of Var123Number /// [JsonIgnore] - public Option Var123NumberOption { get; } // option d + public Option Var123NumberOption { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int? Var123Number { get { return this. Var123NumberOption; } } // d + public int? Var123Number { get { return this. Var123NumberOption; } } /// /// Gets or Sets additional properties @@ -246,7 +246,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123Number.IsSet && var123Number.Value == null) throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); } /// @@ -276,16 +276,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.PropertyOption.IsSet && name.Property == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); // 3 + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) - writer.WriteString("property", name.Property); // 1 + writer.WriteString("property", name.Property); if (name.SnakeCaseOption.IsSet) - writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); if (name.Var123NumberOption.IsSet) - writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs index de0fb2e22484..d453934498af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -51,13 +51,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } // d + public List> AObjVariableobject { get; set; } /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } // d + public int PkiNotificationtestID { get; set; } /// /// Gets or Sets additional properties @@ -157,7 +157,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); } /// @@ -188,8 +188,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElemen throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 7c44215def97..b1824933a08a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -71,145 +71,145 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] - public Option?> ArrayItemsNullableOption { get; private set; } // option d + public Option?> ArrayItemsNullableOption { get; private set; } /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] - public Option?> ObjectItemsNullableOption { get; private set; } // option d + public Option?> ObjectItemsNullableOption { get; private set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] - public Option?> ArrayAndItemsNullablePropOption { get; private set; } // option d + public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ArrayNullableProp /// [JsonIgnore] - public Option?> ArrayNullablePropOption { get; private set; } // option d + public Option?> ArrayNullablePropOption { get; private set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } /// /// Used to track the state of BooleanProp /// [JsonIgnore] - public Option BooleanPropOption { get; private set; } // option d + public Option BooleanPropOption { get; private set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } /// /// Used to track the state of DateProp /// [JsonIgnore] - public Option DatePropOption { get; private set; } // option d + public Option DatePropOption { get; private set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } /// /// Used to track the state of DatetimeProp /// [JsonIgnore] - public Option DatetimePropOption { get; private set; } // option d + public Option DatetimePropOption { get; private set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } /// /// Used to track the state of IntegerProp /// [JsonIgnore] - public Option IntegerPropOption { get; private set; } // option d + public Option IntegerPropOption { get; private set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } /// /// Used to track the state of NumberProp /// [JsonIgnore] - public Option NumberPropOption { get; private set; } // option d + public Option NumberPropOption { get; private set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } /// /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] - public Option?> ObjectAndItemsNullablePropOption { get; private set; } // option d + public Option?> ObjectAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ObjectNullableProp /// [JsonIgnore] - public Option?> ObjectNullablePropOption { get; private set; } // option d + public Option?> ObjectNullablePropOption { get; private set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } /// /// Used to track the state of StringProp /// [JsonIgnore] - public Option StringPropOption { get; private set; } // option d + public Option StringPropOption { get; private set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d + public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } /// /// Gets or Sets additional properties @@ -383,7 +383,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -416,13 +416,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + if (nullableClass.ArrayItemsNullableOption.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + if (nullableClass.ObjectItemsNullableOption.IsSet) writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("array_and_items_nullable_prop"); @@ -430,7 +430,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { writer.WritePropertyName("array_nullable_prop"); @@ -440,35 +440,35 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("array_nullable_prop"); if (nullableClass.BooleanPropOption.IsSet) if (nullableClass.BooleanPropOption.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); else writer.WriteNull("boolean_prop"); if (nullableClass.DatePropOption.IsSet) if (nullableClass.DatePropOption.Value != null) - writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); else writer.WriteNull("date_prop"); if (nullableClass.DatetimePropOption.IsSet) if (nullableClass.DatetimePropOption.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerPropOption.IsSet) if (nullableClass.IntegerPropOption.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); else writer.WriteNull("integer_prop"); if (nullableClass.NumberPropOption.IsSet) if (nullableClass.NumberPropOption.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); else writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -476,7 +476,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { writer.WritePropertyName("object_nullable_prop"); @@ -486,7 +486,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("object_nullable_prop"); if (nullableClass.StringPropOption.IsSet) if (nullableClass.StringPropOption.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp); // 1 + writer.WriteString("string_prop", nullableClass.StringProp); else writer.WriteNull("string_prop"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs index 04c4783d6e5f..cffa703c2481 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs @@ -49,14 +49,14 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); // a + return new NullableGuidClass(uuid); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.UuidOption.IsSet) if (nullableGuidClass.UuidOption.Value != null) - writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs index e9701f89978b..5e07a4b642a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableShape.cs @@ -72,7 +72,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -203,10 +203,10 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType.Value!); // c + return new NullableShape(quadrilateral, shapeType.Value!); if (triangle != null) - return new NullableShape(triangle, shapeType.Value!); // c + return new NullableShape(triangle, shapeType.Value!); throw new JsonException(); } @@ -248,7 +248,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); // 1 + writer.WriteString("shapeType", nullableShape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs index 047a1ae9425a..43c62d78f41c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs @@ -49,13 +49,13 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] - public Option JustNumberOption { get; private set; } // option d + public Option JustNumberOption { get; private set; } /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justNumber.IsSet && justNumber.Value == null) throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber); // a + return new NumberOnly(justNumber); } /// @@ -168,7 +168,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { if (numberOnly.JustNumberOption.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index b5acb1810597..c3b898a32636 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -55,52 +55,52 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] - public Option?> BarsOption { get; private set; } // option d + public Option?> BarsOption { get; private set; } /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } /// /// Used to track the state of DeprecatedRef /// [JsonIgnore] - public Option DeprecatedRefOption { get; private set; } // option d + public Option DeprecatedRefOption { get; private set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -211,7 +211,7 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); } /// @@ -247,17 +247,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + if (objectWithDeprecatedFields.BarsOption.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.IdOption.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); if (objectWithDeprecatedFields.UuidOption.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs index 8f160a2336e7..e2c6672e77d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OneOfString.cs @@ -125,10 +125,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index c9d085afafe1..d4d5be19d315 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -140,75 +140,75 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of PetId /// [JsonIgnore] - public Option PetIdOption { get; private set; } // option d + public Option PetIdOption { get; private set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } /// /// Used to track the state of Quantity /// [JsonIgnore] - public Option QuantityOption { get; private set; } // option d + public Option QuantityOption { get; private set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } /// /// Used to track the state of ShipDate /// [JsonIgnore] - public Option ShipDateOption { get; private set; } // option d + public Option ShipDateOption { get; private set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } /// /// Used to track the state of Complete /// [JsonIgnore] - public Option CompleteOption { get; private set; } // option d + public Option CompleteOption { get; private set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } /// /// Gets or Sets additional properties @@ -344,7 +344,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (complete.IsSet && complete.Value == null) throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id, petId, quantity, shipDate, status, complete); // a + return new Order(id, petId, quantity, shipDate, status, complete); } /// @@ -372,25 +372,25 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { if (order.IdOption.IsSet) - writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", order.IdOption.Value!.Value); if (order.PetIdOption.IsSet) - writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); if (order.QuantityOption.IsSet) - writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); if (order.ShipDateOption.IsSet) - writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index 75d24a0d94e7..4dbabac4e203 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -53,37 +53,37 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] - public Option MyBooleanOption { get; private set; } // option d + public Option MyBooleanOption { get; private set; } /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } /// /// Used to track the state of MyNumber /// [JsonIgnore] - public Option MyNumberOption { get; private set; } // option d + public Option MyNumberOption { get; private set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } /// /// Used to track the state of MyString /// [JsonIgnore] - public Option MyStringOption { get; private set; } // option d + public Option MyStringOption { get; private set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d + public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -185,7 +185,7 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type if (myString.IsSet && myString.Value == null) throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean, myNumber, myString); // a + return new OuterComposite(myBoolean, myNumber, myString); } /// @@ -216,13 +216,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); if (outerComposite.MyBooleanOption.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); if (outerComposite.MyNumberOption.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); if (outerComposite.MyStringOption.IsSet) - writer.WriteString("my_string", outerComposite.MyString); // 1 + writer.WriteString("my_string", outerComposite.MyString); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs index b0e91e45054e..5244fe8b0eff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ParentPet.cs @@ -112,7 +112,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - return new ParentPet(petType.Value!); // a + return new ParentPet(petType.Value!); } /// @@ -142,7 +142,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); // 1 + writer.WriteString("pet_type", parentPet.PetType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index 42ab00563e62..8a94f994361d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -140,63 +140,63 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Gets or Sets Name /// /// doggie [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Gets or Sets PhotoUrls /// [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } // d + public List PhotoUrls { get; set; } /// /// Used to track the state of Category /// [JsonIgnore] - public Option CategoryOption { get; private set; } // option d + public Option CategoryOption { get; private set; } /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d + public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Tags /// [JsonIgnore] - public Option?> TagsOption { get; private set; } // option d + public Option?> TagsOption { get; private set; } /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d + public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } /// /// Gets or Sets additional properties @@ -332,7 +332,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (tags.IsSet && tags.Value == null) throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); } /// @@ -371,23 +371,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.TagsOption.IsSet && pet.Tags == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); // 1 + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 - if (pet.CategoryOption.IsSet) // 14 + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); if (pet.IdOption.IsSet) - writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", pet.IdOption.Value!.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.TagsOption.IsSet) // 14 + if (pet.TagsOption.IsSet) writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs index 12666be9c575..09e650c7df0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pig.cs @@ -72,7 +72,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -203,10 +203,10 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className.Value!); // c + return new Pig(basquePig, className.Value!); if (danishPig != null) - return new Pig(danishPig, className.Value!); // c + return new Pig(danishPig, className.Value!); throw new JsonException(); } @@ -248,7 +248,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); // 1 + writer.WriteString("className", pig.ClassName); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs index d278b8d7b526..5eb22871d845 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/PolymorphicProperty.cs @@ -198,16 +198,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); // b + return new PolymorphicProperty(varBool); if (varString != null) - return new PolymorphicProperty(varString); // b + return new PolymorphicProperty(varString); if (varObject != null) - return new PolymorphicProperty(varObject); // b + return new PolymorphicProperty(varObject); if (list != null) - return new PolymorphicProperty(list); // b + return new PolymorphicProperty(list); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs index 3ab95445465e..dfb4799a35eb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Quadrilateral.cs @@ -72,7 +72,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -203,10 +203,10 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); throw new JsonException(); } @@ -248,7 +248,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs index 7cf9be9e32ba..671d8dac199c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/QuadrilateralInterface.cs @@ -49,7 +49,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T if (quadrilateralType.IsSet && quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType.Value!); // a + return new QuadrilateralInterface(quadrilateralType.Value!); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index f7130d58f4ff..d1e1ef5dede8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -51,25 +51,25 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } } // d + public string? Bar { get { return this. BarOption; } } /// /// Used to track the state of Baz /// [JsonIgnore] - public Option BazOption { get; private set; } // option d + public Option BazOption { get; private set; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d + public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } /// /// Gets or Sets additional properties @@ -199,7 +199,7 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (baz.IsSet && baz.Value == null) throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); // a + return new ReadOnlyFirst(bar, baz); } /// @@ -233,10 +233,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); if (readOnlyFirst.BarOption.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar); // 1 + writer.WriteString("bar", readOnlyFirst.Bar); if (readOnlyFirst.BazOption.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz); // 1 + writer.WriteString("baz", readOnlyFirst.Baz); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs index 957bd4048032..4632fedd84f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -194,7 +194,7 @@ public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnulla /// Gets or Sets RequiredNotnullableEnumInteger /// [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } /// /// Defines RequiredNotnullableEnumIntegerOnly @@ -259,7 +259,7 @@ public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotn /// Gets or Sets RequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNotnullableEnumString @@ -415,13 +415,13 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul /// Gets or Sets RequiredNotnullableEnumString /// [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } /// /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNotnullableEnumInteger @@ -486,13 +486,13 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumInteger /// [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumIntegerOnly @@ -557,13 +557,13 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumString @@ -719,25 +719,25 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumString /// [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines RequiredNullableEnumInteger @@ -802,7 +802,7 @@ public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnu /// Gets or Sets RequiredNullableEnumInteger /// [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// /// Defines RequiredNullableEnumIntegerOnly @@ -867,7 +867,7 @@ public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullabl /// Gets or Sets RequiredNullableEnumIntegerOnly /// [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNullableEnumString @@ -1026,13 +1026,13 @@ public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromS /// Gets or Sets RequiredNullableEnumString /// [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNullableEnumInteger @@ -1097,13 +1097,13 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumInteger /// [JsonPropertyName("notrequired_nullable_enum_integer")] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNullableEnumIntegerOnly @@ -1168,13 +1168,13 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumIntegerOnly /// [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNullableEnumString @@ -1333,281 +1333,281 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] - public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumString /// [JsonPropertyName("notrequired_nullable_enum_string")] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } /// /// Gets or Sets RequiredNotNullableDateProp /// [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } // d + public DateTime RequiredNotNullableDateProp { get; set; } /// /// Gets or Sets RequiredNotnullableArrayOfString /// [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } // d + public List RequiredNotnullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNotnullableBooleanProp /// [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } // d + public bool RequiredNotnullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNotnullableDatetimeProp /// [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + public DateTime RequiredNotnullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNotnullableStringProp /// [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } // d + public string RequiredNotnullableStringProp { get; set; } /// /// Gets or Sets RequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } // d + public Guid RequiredNotnullableUuid { get; set; } /// /// Gets or Sets RequiredNotnullableintegerProp /// [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } // d + public int RequiredNotnullableintegerProp { get; set; } /// /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] - public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableDateProp /// [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableintegerProp /// [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] - public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableArrayOfString /// [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableBooleanProp /// [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableDatetimeProp /// [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] - public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableStringProp /// [JsonPropertyName("notrequired_notnullable_string_prop")] - public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] - public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + public Option NotrequiredNotnullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Gets or Sets RequiredNullableArrayOfString /// [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } // d + public List? RequiredNullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNullableBooleanProp /// [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } // d + public bool? RequiredNullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNullableDateProp /// [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } // d + public DateTime? RequiredNullableDateProp { get; set; } /// /// Gets or Sets RequiredNullableDatetimeProp /// [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } // d + public DateTime? RequiredNullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNullableIntegerProp /// [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } // d + public int? RequiredNullableIntegerProp { get; set; } /// /// Gets or Sets RequiredNullableStringProp /// [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } // d + public string? RequiredNullableStringProp { get; set; } /// /// Gets or Sets RequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } // d + public Guid? RequiredNullableUuid { get; set; } /// /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] - public Option NotRequiredNullableDatePropOption { get; private set; } // option d + public Option NotRequiredNullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableDateProp /// [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] - public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableIntegerProp /// [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] - public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableArrayOfString /// [JsonPropertyName("notrequired_nullable_array_of_string")] - public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableBooleanProp /// [JsonPropertyName("notrequired_nullable_boolean_prop")] - public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableDatetimeProp /// [JsonPropertyName("notrequired_nullable_datetime_prop")] - public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] - public Option NotrequiredNullableStringPropOption { get; private set; } // option d + public Option NotrequiredNullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableStringProp /// [JsonPropertyName("notrequired_nullable_string_prop")] - public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] - public Option NotrequiredNullableUuidOption { get; private set; } // option d + public Option NotrequiredNullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_nullable_uuid")] - public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -2123,7 +2123,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2162,72 +2162,72 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else writer.WriteNull("required_notnullable_enum_string"); - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else writer.WriteNull("notrequired_notnullable_enum_string"); - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); - if (requiredClass.RequiredNullableArrayOfString != null) // 12 + if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2235,46 +2235,46 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_array_of_string"); if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); else writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); else writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); else writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); else writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); else writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); else writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); else @@ -2282,28 +2282,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); else writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2313,51 +2313,51 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_array_of_string"); if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); else writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); else writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); if (requiredClass.NotrequiredNullableStringPropOption.IsSet) if (requiredClass.NotrequiredNullableStringPropOption.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); else writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuidOption.IsSet) if (requiredClass.NotrequiredNullableUuidOption.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs index b2f420aca31d..69892b578d10 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs @@ -49,13 +49,13 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] - public Option VarReturnOption { get; private set; } // option d + public Option VarReturnOption { get; private set; } /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (varReturn.IsSet && varReturn.Value == null) throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn); // a + return new Return(varReturn); } /// @@ -168,7 +168,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { if (varReturn.VarReturnOption.IsSet) - writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index bbf5b551c2bc..f1c4519c0302 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -51,25 +51,25 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] - public Option RoleOption { get; private set; } // option d + public Option RoleOption { get; private set; } /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } /// /// Used to track the state of RoleUuid /// [JsonIgnore] - public Option RoleUuidOption { get; private set; } // option d + public Option RoleUuidOption { get; private set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -163,7 +163,7 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty if (roleUuid.IsSet && roleUuid.Value == null) throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid); // a + return new RolesReportsHash(role, roleUuid); } /// @@ -193,11 +193,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - if (rolesReportsHash.RoleOption.IsSet) // 14 + if (rolesReportsHash.RoleOption.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuidOption.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 71951eece545..57d819b866ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -49,13 +49,13 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); // a + return new RolesReportsHashRole(name); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.NameOption.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name); // 1 + writer.WriteString("name", rolesReportsHashRole.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs index c13400169067..df238cd6fb8d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ScaleneTriangle.cs @@ -51,13 +51,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -155,7 +155,7 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -188,9 +188,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs index e10c3c177dc3..d7f628a58c9a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Shape.cs @@ -72,7 +72,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -203,10 +203,10 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType.Value!); // c + return new Shape(quadrilateral, shapeType.Value!); if (triangle != null) - return new Shape(triangle, shapeType.Value!); // c + return new Shape(triangle, shapeType.Value!); throw new JsonException(); } @@ -248,7 +248,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); // 1 + writer.WriteString("shapeType", shape.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs index 81906ab67c51..bd75259c1192 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeInterface.cs @@ -49,7 +49,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - return new ShapeInterface(shapeType.Value!); // a + return new ShapeInterface(shapeType.Value!); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 + writer.WriteString("shapeType", shapeInterface.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs index a55562533625..b7063afd9a1c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ShapeOrNull.cs @@ -72,7 +72,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -203,10 +203,10 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType.Value!); // c + return new ShapeOrNull(quadrilateral, shapeType.Value!); if (triangle != null) - return new ShapeOrNull(triangle, shapeType.Value!); // c + return new ShapeOrNull(triangle, shapeType.Value!); throw new JsonException(); } @@ -248,7 +248,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs index 1fb9bb58dc43..9e2ecd14d85e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SimpleQuadrilateral.cs @@ -51,13 +51,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -155,7 +155,7 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); } /// @@ -188,9 +188,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index c73356705c49..206826d83872 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -51,25 +51,25 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] - public Option VarSpecialModelNameOption { get; private set; } // option d + public Option VarSpecialModelNameOption { get; private set; } /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } /// /// Used to track the state of SpecialPropertyName /// [JsonIgnore] - public Option SpecialPropertyNameOption { get; private set; } // option d + public Option SpecialPropertyNameOption { get; private set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty if (specialPropertyName.IsSet && specialPropertyName.Value == null) throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName); // a + return new SpecialModelName(varSpecialModelName, specialPropertyName); } /// @@ -193,10 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); if (specialModelName.VarSpecialModelNameOption.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); if (specialModelName.SpecialPropertyNameOption.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index a78152574cd9..fa9ac0352198 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -51,25 +51,25 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id, name); // a + return new Tag(id, name); } /// @@ -193,10 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); if (tag.IdOption.IsSet) - writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", tag.IdOption.Value!.Value); if (tag.NameOption.IsSet) - writer.WriteString("name", tag.Name); // 1 + writer.WriteString("name", tag.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index be4936833f4f..7429b824f680 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -49,13 +49,13 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] - public Option ValueOption { get; private set; } // option d + public Option ValueOption { get; private set; } /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d + public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso if (value.IsSet && value.Value == null) throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); // a + return new TestCollectionEndingWithWordList(value); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.ValueOption.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index c267736dfa61..a8c31c8f2d96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -49,13 +49,13 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] - public Option?> TestCollectionEndingWithWordListOption { get; private set; } // option d + public Option?> TestCollectionEndingWithWordListOption { get; private set; } /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d + public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } /// /// Gets or Sets additional properties @@ -140,7 +140,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 090acbb01537..ffbca2de0460 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -49,13 +49,13 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option somePropert /// Used to track the state of SomeProperty /// [JsonIgnore] - public Option SomePropertyOption { get; private set; } // option d + public Option SomePropertyOption { get; private set; } /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d + public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -150,7 +150,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR if (someProperty.IsSet && someProperty.Value == null) throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -181,7 +181,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs index aa7aa28e97a0..932095793874 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Triangle.cs @@ -89,7 +89,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -226,13 +226,13 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType.Value!); // c + return new Triangle(equilateralTriangle, triangleType.Value!); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType.Value!); // c + return new Triangle(isoscelesTriangle, triangleType.Value!); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType.Value!); // c + return new Triangle(scaleneTriangle, triangleType.Value!); throw new JsonException(); } @@ -279,7 +279,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); // 1 + writer.WriteString("triangleType", triangle.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs index e6e1f48112a1..3e50cd4e3263 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TriangleInterface.cs @@ -49,7 +49,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - return new TriangleInterface(triangleType.Value!); // a + return new TriangleInterface(triangleType.Value!); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 + writer.WriteString("triangleType", triangleInterface.TriangleType); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index d0c956a6f698..28d324b1afae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -71,150 +71,150 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Email /// [JsonIgnore] - public Option EmailOption { get; private set; } // option d + public Option EmailOption { get; private set; } /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } /// /// Used to track the state of FirstName /// [JsonIgnore] - public Option FirstNameOption { get; private set; } // option d + public Option FirstNameOption { get; private set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of LastName /// [JsonIgnore] - public Option LastNameOption { get; private set; } // option d + public Option LastNameOption { get; private set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } /// /// Used to track the state of Password /// [JsonIgnore] - public Option PasswordOption { get; private set; } // option d + public Option PasswordOption { get; private set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } /// /// Used to track the state of Phone /// [JsonIgnore] - public Option PhoneOption { get; private set; } // option d + public Option PhoneOption { get; private set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } /// /// Used to track the state of UserStatus /// [JsonIgnore] - public Option UserStatusOption { get; private set; } // option d + public Option UserStatusOption { get; private set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } /// /// Used to track the state of Username /// [JsonIgnore] - public Option UsernameOption { get; private set; } // option d + public Option UsernameOption { get; private set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } /// /// Used to track the state of AnyTypeProp /// [JsonIgnore] - public Option AnyTypePropOption { get; private set; } // option d + public Option AnyTypePropOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } /// /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] - public Option AnyTypePropNullableOption { get; private set; } // option d + public Option AnyTypePropNullableOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } /// /// Gets or Sets additional properties @@ -383,7 +383,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -432,33 +432,33 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); if (user.EmailOption.IsSet) - writer.WriteString("email", user.Email); // 1 + writer.WriteString("email", user.Email); if (user.FirstNameOption.IsSet) - writer.WriteString("firstName", user.FirstName); // 1 + writer.WriteString("firstName", user.FirstName); if (user.IdOption.IsSet) - writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", user.IdOption.Value!.Value); if (user.LastNameOption.IsSet) - writer.WriteString("lastName", user.LastName); // 1 + writer.WriteString("lastName", user.LastName); - if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsOption.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.PasswordOption.IsSet) - writer.WriteString("password", user.Password); // 1 + writer.WriteString("password", user.Password); if (user.PhoneOption.IsSet) - writer.WriteString("phone", user.Phone); // 1 + writer.WriteString("phone", user.Phone); if (user.UserStatusOption.IsSet) - writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); if (user.UsernameOption.IsSet) - writer.WriteString("username", user.Username); // 1 + writer.WriteString("username", user.Username); - if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) { writer.WritePropertyName("anyTypeProp"); @@ -466,7 +466,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.IsSet) if (user.AnyTypePropNullableOption.Value != null) { writer.WritePropertyName("anyTypePropNullable"); @@ -474,7 +474,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) { writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index a476d1bc5b05..f437211ac79c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -53,31 +53,31 @@ public Whale(string className, Option hasBaleen = default, Option /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of HasBaleen /// [JsonIgnore] - public Option HasBaleenOption { get; private set; } // option d + public Option HasBaleenOption { get; private set; } /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } /// /// Used to track the state of HasTeeth /// [JsonIgnore] - public Option HasTeethOption { get; private set; } // option d + public Option HasTeethOption { get; private set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } /// /// Gets or Sets additional properties @@ -182,7 +182,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (hasTeeth.IsSet && hasTeeth.Value == null) throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className.Value!, hasBaleen, hasTeeth); // a + return new Whale(className.Value!, hasBaleen, hasTeeth); } /// @@ -212,13 +212,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); // 1 + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); if (whale.HasTeethOption.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index 6a4179e25f09..eb95726cd125 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -131,19 +131,19 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option a + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -251,7 +251,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className.Value!, type); // a + return new Zebra(className.Value!, type); } /// @@ -281,9 +281,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); // 1 + writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index b1a3ce3bf47a..e4728c61db00 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -115,13 +115,13 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] - public Option ZeroBasedEnumOption { get; private set; } // option a + public Option ZeroBasedEnumOption { get; private set; } /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -207,7 +207,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum); // a + return new ZeroBasedEnumClass(zeroBasedEnum); } /// @@ -234,7 +234,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index ed80a50c6d4e..41c0285d0baa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -48,13 +48,13 @@ public Activity(Option [JsonIgnore] - public Option>?> ActivityOutputsOption { get; private set; } // option d + public Option>?> ActivityOutputsOption { get; private set; } /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d + public Dictionary>? ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (activityOutputs.IsSet && activityOutputs.Value == null) throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); // a + return new Activity(activityOutputs); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - if (activity.ActivityOutputsOption.IsSet) // 14 + if (activity.ActivityOutputsOption.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index edf434ea59d9..ddeb9eb9bae5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -50,25 +50,25 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop1 /// [JsonIgnore] - public Option Prop1Option { get; private set; } // option d + public Option Prop1Option { get; private set; } /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + public string? Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } /// /// Used to track the state of Prop2 /// [JsonIgnore] - public Option Prop2Option { get; private set; } // option d + public Option Prop2Option { get; private set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d + public Object? Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } /// /// Gets or Sets additional properties @@ -161,7 +161,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 if (prop2.IsSet && prop2.Value == null) throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); // a + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -195,9 +195,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); if (activityOutputElementRepresentation.Prop1Option.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + if (activityOutputElementRepresentation.Prop2Option.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 11cb24ec9214..189128f9c80d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -62,98 +62,98 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] - public Option EmptyMapOption { get; private set; } // option d + public Option EmptyMapOption { get; private set; } /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + public Object? EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } /// /// Used to track the state of MapOfMapProperty /// [JsonIgnore] - public Option>?> MapOfMapPropertyOption { get; private set; } // option d + public Option>?> MapOfMapPropertyOption { get; private set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + public Dictionary>? MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } /// /// Used to track the state of MapProperty /// [JsonIgnore] - public Option?> MapPropertyOption { get; private set; } // option d + public Option?> MapPropertyOption { get; private set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + public Dictionary? MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + public Object? MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + public Object? MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 /// [JsonIgnore] - public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d + public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + public Dictionary? MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesString /// [JsonIgnore] - public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d + public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + public Dictionary? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } /// /// Used to track the state of Anytype1 /// [JsonIgnore] - public Option Anytype1Option { get; private set; } // option d + public Option Anytype1Option { get; private set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } /// /// Gets or Sets additional properties @@ -298,7 +298,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -346,28 +346,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + if (additionalPropertiesClass.EmptyMapOption.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapPropertyOption.IsSet) writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { writer.WritePropertyName("anytype_1"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 7de0fa688326..08bc7e962c01 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -50,19 +50,19 @@ public Animal(string className, Option color = default) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Gets or Sets additional properties @@ -167,7 +167,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className.Value!, color); // a + return new Animal(className.Value!, color); } /// @@ -200,10 +200,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.ColorOption.IsSet && animal.Color == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); // 1 + writer.WriteString("className", animal.ClassName); if (animal.ColorOption.IsSet) - writer.WriteString("color", animal.Color); // 1 + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index 54e6d563eeb2..7f441f4d366d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -52,37 +52,37 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Code /// [JsonIgnore] - public Option CodeOption { get; private set; } // option d + public Option CodeOption { get; private set; } /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } /// /// Used to track the state of Message /// [JsonIgnore] - public Option MessageOption { get; private set; } // option d + public Option MessageOption { get; private set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + public string? Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } /// /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option d + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets additional properties @@ -183,7 +183,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code, message, type); // a + return new ApiResponse(code, message, type); } /// @@ -217,13 +217,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); if (apiResponse.CodeOption.IsSet) - writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); // 3 + writer.WriteNumber("code", apiResponse.CodeOption.Value!.Value); if (apiResponse.MessageOption.IsSet) - writer.WriteString("message", apiResponse.Message); // 1 + writer.WriteString("message", apiResponse.Message); if (apiResponse.TypeOption.IsSet) - writer.WriteString("type", apiResponse.Type); // 1 + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index f8da39d01873..c22fe306b31a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -52,37 +52,37 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of ColorCode /// [JsonIgnore] - public Option ColorCodeOption { get; private set; } // option d + public Option ColorCodeOption { get; private set; } /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + public string? ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } /// /// Used to track the state of Cultivar /// [JsonIgnore] - public Option CultivarOption { get; private set; } // option d + public Option CultivarOption { get; private set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + public string? Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } /// /// Used to track the state of Origin /// [JsonIgnore] - public Option OriginOption { get; private set; } // option d + public Option OriginOption { get; private set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d + public string? Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } /// /// Gets or Sets additional properties @@ -212,7 +212,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (origin.IsSet && origin.Value == null) throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); // a + return new Apple(colorCode, cultivar, origin); } /// @@ -249,13 +249,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); if (apple.ColorCodeOption.IsSet) - writer.WriteString("color_code", apple.ColorCode); // 1 + writer.WriteString("color_code", apple.ColorCode); if (apple.CultivarOption.IsSet) - writer.WriteString("cultivar", apple.Cultivar); // 1 + writer.WriteString("cultivar", apple.Cultivar); if (apple.OriginOption.IsSet) - writer.WriteString("origin", apple.Origin); // 1 + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 546296312e18..142f0b1518e6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -50,19 +50,19 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } // d + public string Cultivar { get; set; } /// /// Used to track the state of Mealy /// [JsonIgnore] - public Option MealyOption { get; private set; } // option d + public Option MealyOption { get; private set; } /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } /// /// Returns the string presentation of the object @@ -151,7 +151,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (mealy.IsSet && mealy.Value == null) throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar.Value!, mealy); // a + return new AppleReq(cultivar.Value!, mealy); } /// @@ -181,10 +181,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); // 1 + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) - writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); // 2 + writer.WriteBoolean("mealy", appleReq.MealyOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 85430bae3573..0e0ba0f16e5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -48,13 +48,13 @@ public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] - public Option>?> ArrayArrayNumberOption { get; private set; } // option d + public Option>?> ArrayArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d + public List>? ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 4e84736fc44e..8e98d4ae0670 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -48,13 +48,13 @@ public ArrayOfNumberOnly(Option?> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] - public Option?> ArrayNumberOption { get; private set; } // option d + public Option?> ArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d + public List? ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t if (arrayNumber.IsSet && arrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); // a + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 4b4d6bb2f56e..93897f864e51 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -52,37 +52,37 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] - public Option>?> ArrayArrayOfIntegerOption { get; private set; } // option d + public Option>?> ArrayArrayOfIntegerOption { get; private set; } /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + public List>? ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } /// /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] - public Option>?> ArrayArrayOfModelOption { get; private set; } // option d + public Option>?> ArrayArrayOfModelOption { get; private set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + public List>? ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } /// /// Used to track the state of ArrayOfString /// [JsonIgnore] - public Option?> ArrayOfStringOption { get; private set; } // option d + public Option?> ArrayOfStringOption { get; private set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d + public List? ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -185,7 +185,7 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (arrayOfString.IsSet && arrayOfString.Value == null) throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -221,13 +221,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfModelOption.IsSet) writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfStringOption.IsSet) // 14 + if (arrayTest.ArrayOfStringOption.IsSet) writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index 5e1ceb0f75a0..a73d3d129d9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -48,13 +48,13 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] - public Option LengthCmOption { get; private set; } // option d + public Option LengthCmOption { get; private set; } /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (lengthCm.IsSet && lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm); // a + return new Banana(lengthCm); } /// @@ -167,7 +167,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.LengthCmOption.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); // 3 + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index 6cd37b9df16b..ba5c1b900cf4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -50,19 +50,19 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } // d + public decimal LengthCm { get; set; } /// /// Used to track the state of Sweet /// [JsonIgnore] - public Option SweetOption { get; private set; } // option d + public Option SweetOption { get; private set; } /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } /// /// Returns the string presentation of the object @@ -152,7 +152,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (sweet.IsSet && sweet.Value == null) throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value!.Value!, sweet); // a + return new BananaReq(lengthCm.Value!.Value!, sweet); } /// @@ -179,10 +179,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) - writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); // 2 + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs index 087ab4338457..6388a29478f7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BasquePig.cs @@ -48,7 +48,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - return new BasquePig(className.Value!); // a + return new BasquePig(className.Value!); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); // 1 + writer.WriteString("className", basquePig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index 6551d591601f..a107c08899a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -58,74 +58,74 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of ATT_NAME /// [JsonIgnore] - public Option ATT_NAMEOption { get; private set; } // option d + public Option ATT_NAMEOption { get; private set; } /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + public string? ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } /// /// Used to track the state of CapitalCamel /// [JsonIgnore] - public Option CapitalCamelOption { get; private set; } // option d + public Option CapitalCamelOption { get; private set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + public string? CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } /// /// Used to track the state of CapitalSnake /// [JsonIgnore] - public Option CapitalSnakeOption { get; private set; } // option d + public Option CapitalSnakeOption { get; private set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + public string? CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } /// /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] - public Option SCAETHFlowPointsOption { get; private set; } // option d + public Option SCAETHFlowPointsOption { get; private set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + public string? SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } /// /// Used to track the state of SmallCamel /// [JsonIgnore] - public Option SmallCamelOption { get; private set; } // option d + public Option SmallCamelOption { get; private set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + public string? SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } /// /// Used to track the state of SmallSnake /// [JsonIgnore] - public Option SmallSnakeOption { get; private set; } // option d + public Option SmallSnakeOption { get; private set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d + public string? SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } /// /// Gets or Sets additional properties @@ -249,7 +249,7 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type if (smallSnake.IsSet && smallSnake.Value == null) throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -295,22 +295,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); if (capitalization.ATT_NAMEOption.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); if (capitalization.CapitalCamelOption.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); if (capitalization.CapitalSnakeOption.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); if (capitalization.SCAETHFlowPointsOption.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); if (capitalization.SmallCamelOption.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + writer.WriteString("smallCamel", capitalization.SmallCamel); if (capitalization.SmallSnakeOption.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index e21a06633ffc..d38c8e9bdca9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -50,13 +50,13 @@ public Cat(string className, Option declawed = default, Option c /// Used to track the state of Declawed /// [JsonIgnore] - public Option DeclawedOption { get; private set; } // option d + public Option DeclawedOption { get; private set; } /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } /// /// Returns the string presentation of the object @@ -142,7 +142,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value!, declawed, color); // a + return new Cat(className.Value!, declawed, color); } /// @@ -175,13 +175,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.ColorOption.IsSet && cat.Color == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); // 1 + writer.WriteString("className", cat.ClassName); if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); // 2 + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); if (cat.ColorOption.IsSet) - writer.WriteString("color", cat.Color); // 1 + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index aac8cde4154a..244bbfa01bac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -50,19 +50,19 @@ public Category(string name = @"default-name", Option id = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Gets or Sets additional properties @@ -158,7 +158,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value!, id); // a + return new Category(name.Value!, id); } /// @@ -188,10 +188,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); // 1 + writer.WriteString("name", category.Name); if (category.IdOption.IsSet) - writer.WriteNumber("id", category.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", category.IdOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index 351b15019921..033bc5d0ef97 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -102,25 +102,25 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] - public new Option PetTypeOption { get; private set; } // option a + public new Option PetTypeOption { get; private set; } /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Returns the string presentation of the object @@ -198,7 +198,7 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType); // a + return new ChildCat(name, petType); } /// @@ -229,9 +229,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); if (childCat.NameOption.IsSet) - writer.WriteString("name", childCat.Name); // 1 + writer.WriteString("name", childCat.Name); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); // 7 + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value!.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 73d76309c5ca..40d67209d497 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -48,13 +48,13 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (varClass.IsSet && varClass.Value == null) throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); // a + return new ClassModel(varClass); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClassOption.IsSet) - writer.WriteString("_class", classModel.VarClass); // 1 + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 2c5463a08604..6e9034b20b2a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -50,13 +50,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new ComplexQuadrilateral(quadrilateralType.Value!, shapeType.Value!); } /// @@ -187,9 +187,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs index 0728f95344ec..cb41bcddcd6c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DanishPig.cs @@ -48,7 +48,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - return new DanishPig(className.Value!); // a + return new DanishPig(className.Value!); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); // 1 + writer.WriteString("className", danishPig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 5deed266d155..adefb2a40ecb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -48,14 +48,14 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] - public Option DateOnlyPropertyOption { get; private set; } // option d + public Option DateOnlyPropertyOption { get; private set; } /// /// Gets or Sets DateOnlyProperty /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -145,7 +145,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty); // a + return new DateOnlyClass(dateOnlyProperty); } /// @@ -173,7 +173,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyPropertyOption.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); // 4 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value!.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index f3245a4e6d73..617ddf0e7b28 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -48,13 +48,13 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); // a + return new DeprecatedObject(name); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.NameOption.IsSet) - writer.WriteString("name", deprecatedObject.Name); // 1 + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 2a56dadbab0e..202aec314630 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -50,13 +50,13 @@ public Dog(string className, Option breed = default, Option co /// Used to track the state of Breed /// [JsonIgnore] - public Option BreedOption { get; private set; } // option d + public Option BreedOption { get; private set; } /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d + public string? Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } /// /// Returns the string presentation of the object @@ -141,7 +141,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(className.Value!, breed, color); // a + return new Dog(className.Value!, breed, color); } /// @@ -177,13 +177,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.ColorOption.IsSet && dog.Color == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); // 1 + writer.WriteString("className", dog.ClassName); if (dog.BreedOption.IsSet) - writer.WriteString("breed", dog.Breed); // 1 + writer.WriteString("breed", dog.Breed); if (dog.ColorOption.IsSet) - writer.WriteString("color", dog.Color); // 1 + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 6a4a70997447..4694be7eae63 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -54,49 +54,49 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of MainShape /// [JsonIgnore] - public Option MainShapeOption { get; private set; } // option d + public Option MainShapeOption { get; private set; } /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } /// /// Used to track the state of Shapes /// [JsonIgnore] - public Option?> ShapesOption { get; private set; } // option d + public Option?> ShapesOption { get; private set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } /// /// Used to track the state of NullableShape /// [JsonIgnore] - public Option NullableShapeOption { get; private set; } // option d + public Option NullableShapeOption { get; private set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + public NullableShape? NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } /// /// Used to track the state of ShapeOrNull /// [JsonIgnore] - public Option ShapeOrNullOption { get; private set; } // option d + public Option ShapeOrNullOption { get; private set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d + public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } /// /// Gets or Sets additional properties @@ -213,7 +213,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -246,13 +246,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri if (drawing.ShapesOption.IsSet && drawing.Shapes == null) throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - if (drawing.MainShapeOption.IsSet) // 14 + if (drawing.MainShapeOption.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.ShapesOption.IsSet) // 14 + if (drawing.ShapesOption.IsSet) writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { writer.WritePropertyName("nullableShape"); @@ -260,7 +260,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.IsSet) if (drawing.ShapeOrNullOption.Value != null) { writer.WritePropertyName("shapeOrNull"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index cfda5d8a343c..6a1110d6d05f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -182,25 +182,25 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] - public Option JustSymbolOption { get; private set; } // option a + public Option JustSymbolOption { get; private set; } /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } /// /// Used to track the state of ArrayEnum /// [JsonIgnore] - public Option?> ArrayEnumOption { get; private set; } // option d + public Option?> ArrayEnumOption { get; private set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d + public List? ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -295,7 +295,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justSymbol.IsSet && justSymbol.Value == null) throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol); // a + return new EnumArrays(arrayEnum, justSymbol); } /// @@ -325,10 +325,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - if (enumArrays.ArrayEnumOption.IsSet) // 14 + if (enumArrays.ArrayEnumOption.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); // 7 + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 4f13dbe3902c..8b8202a81e9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -214,7 +214,7 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets EnumStringRequired /// [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Defines EnumInteger @@ -279,13 +279,13 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] - public Option EnumIntegerOption { get; private set; } // option a + public Option EnumIntegerOption { get; private set; } /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } /// /// Defines EnumIntegerOnly @@ -350,13 +350,13 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] - public Option EnumIntegerOnlyOption { get; private set; } // option a + public Option EnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } /// /// Defines EnumNumber @@ -428,13 +428,13 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] - public Option EnumNumberOption { get; private set; } // option a + public Option EnumNumberOption { get; private set; } /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } /// /// Defines EnumString @@ -590,61 +590,61 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] - public Option EnumStringOption { get; private set; } // option a + public Option EnumStringOption { get; private set; } /// /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } /// /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] - public Option OuterEnumDefaultValueOption { get; private set; } // option a + public Option OuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnumInteger /// [JsonIgnore] - public Option OuterEnumIntegerOption { get; private set; } // option a + public Option OuterEnumIntegerOption { get; private set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } /// /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] - public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a + public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnum /// [JsonIgnore] - public Option OuterEnumOption { get; private set; } // option a + public Option OuterEnumOption { get; private set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -807,7 +807,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); } /// @@ -834,46 +834,46 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); if (enumTest.EnumIntegerOption.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value!.Value)); if (enumTest.EnumIntegerOnlyOption.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value!.Value)); if (enumTest.EnumNumberOption.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); // 6 + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value!.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); // 7 + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value!.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else writer.WriteNull("enum_string"); - if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumDefaultValueOption.IsSet) { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); // 10 b + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); } - if (enumTest.OuterEnumIntegerOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerOption.IsSet) { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); // 10 b + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger!.Value); writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } - if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); // 10 b + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) // 10 - if (enumTest.OuterEnumOption!.Value != null) // 10 a + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); // 10 c + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); writer.WriteString("outerEnum", outerEnumRawValue); } else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index c1e1e3ab819e..67be73e69d8e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -50,13 +50,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); // a + return new EquilateralTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -187,9 +187,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index 01af1a7a0881..a3c25e333231 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -48,14 +48,14 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] - public Option SourceURIOption { get; private set; } // option d + public Option SourceURIOption { get; private set; } /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d + public string? SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (sourceURI.IsSet && sourceURI.Value == null) throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); // a + return new File(sourceURI); } /// @@ -170,7 +170,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURIOption.IsSet) - writer.WriteString("sourceURI", file.SourceURI); // 1 + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index b1bf76695699..f340318cd6b6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -50,25 +50,25 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of File /// [JsonIgnore] - public Option FileOption { get; private set; } // option d + public Option FileOption { get; private set; } /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + public File? File { get { return this. FileOption; } set { this.FileOption = new(value); } } /// /// Used to track the state of Files /// [JsonIgnore] - public Option?> FilesOption { get; private set; } // option d + public Option?> FilesOption { get; private set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d + public List? Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type if (files.IsSet && files.Value == null) throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); // a + return new FileSchemaTestClass(file, files); } /// @@ -195,10 +195,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - if (fileSchemaTestClass.FileOption.IsSet) // 14 + if (fileSchemaTestClass.FileOption.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.FilesOption.IsSet) // 14 + if (fileSchemaTestClass.FilesOption.IsSet) writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index cccd77933ba9..e7a91d642c5c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -48,13 +48,13 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; private set; } // option d + public Option BarOption { get; private set; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d + public string? Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (bar.IsSet && bar.Value == null) throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); // a + return new Foo(bar); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.BarOption.IsSet) - writer.WriteString("bar", foo.Bar); // 1 + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 7477772acb05..73a827b3d6cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -48,13 +48,13 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public Foo? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); // a + return new FooGetDefaultResponse(varString); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + if (fooGetDefaultResponse.VarStringOption.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 2d95559224b8..2a9d809236a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -84,211 +84,211 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } // d + public byte[] VarByte { get; set; } /// /// Gets or Sets Date /// /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } // d + public DateTime Date { get; set; } /// /// Gets or Sets Number /// [JsonPropertyName("number")] - public decimal Number { get; set; } // d + public decimal Number { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } // d + public string Password { get; set; } /// /// Used to track the state of Binary /// [JsonIgnore] - public Option BinaryOption { get; private set; } // option d + public Option BinaryOption { get; private set; } /// /// Gets or Sets Binary /// [JsonPropertyName("binary")] - public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + public System.IO.Stream? Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } /// /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of VarDecimal /// [JsonIgnore] - public Option VarDecimalOption { get; private set; } // option d + public Option VarDecimalOption { get; private set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } /// /// Used to track the state of VarDouble /// [JsonIgnore] - public Option VarDoubleOption { get; private set; } // option d + public Option VarDoubleOption { get; private set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } /// /// Used to track the state of VarFloat /// [JsonIgnore] - public Option VarFloatOption { get; private set; } // option d + public Option VarFloatOption { get; private set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } /// /// Used to track the state of Int32 /// [JsonIgnore] - public Option Int32Option { get; private set; } // option d + public Option Int32Option { get; private set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } /// /// Used to track the state of Int64 /// [JsonIgnore] - public Option Int64Option { get; private set; } // option d + public Option Int64Option { get; private set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } /// /// Used to track the state of Integer /// [JsonIgnore] - public Option IntegerOption { get; private set; } // option d + public Option IntegerOption { get; private set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } /// /// Used to track the state of PatternWithBackslash /// [JsonIgnore] - public Option PatternWithBackslashOption { get; private set; } // option d + public Option PatternWithBackslashOption { get; private set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + public string? PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } /// /// Used to track the state of PatternWithDigits /// [JsonIgnore] - public Option PatternWithDigitsOption { get; private set; } // option d + public Option PatternWithDigitsOption { get; private set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + public string? PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } /// /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] - public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d + public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + public string? PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } /// /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public string? VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Used to track the state of UnsignedInteger /// [JsonIgnore] - public Option UnsignedIntegerOption { get; private set; } // option d + public Option UnsignedIntegerOption { get; private set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } /// /// Used to track the state of UnsignedLong /// [JsonIgnore] - public Option UnsignedLongOption { get; private set; } // option d + public Option UnsignedLongOption { get; private set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -676,7 +676,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a + return new FormatTest(varByte.Value!, date.Value!.Value!, number.Value!.Value!, password.Value!, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); } /// @@ -725,57 +725,57 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); // 3 + writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); // 1 + writer.WriteString("password", formatTest.Password); - if (formatTest.BinaryOption.IsSet) // 14 + if (formatTest.BinaryOption.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTimeOption.IsSet) - writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimalOption.IsSet) // 14 + if (formatTest.VarDecimalOption.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDoubleOption.IsSet) - writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); // 3 + writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); if (formatTest.VarFloatOption.IsSet) - writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); // 3 + writer.WriteNumber("float", formatTest.VarFloatOption.Value!.Value); if (formatTest.Int32Option.IsSet) - writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); // 3 + writer.WriteNumber("int32", formatTest.Int32Option.Value!.Value); if (formatTest.Int64Option.IsSet) - writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); // 3 + writer.WriteNumber("int64", formatTest.Int64Option.Value!.Value); if (formatTest.IntegerOption.IsSet) - writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); // 3 + writer.WriteNumber("integer", formatTest.IntegerOption.Value!.Value); if (formatTest.PatternWithBackslashOption.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); if (formatTest.PatternWithDigitsOption.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); if (formatTest.VarStringOption.IsSet) - writer.WriteString("string", formatTest.VarString); // 1 + writer.WriteString("string", formatTest.VarString); if (formatTest.UnsignedIntegerOption.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value!.Value); if (formatTest.UnsignedLongOption.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); // 3 + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value!.Value); if (formatTest.UuidOption.IsSet) - writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", formatTest.UuidOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 167d7de7e4c7..06a7ad5d5d82 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -71,13 +71,13 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -177,10 +177,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); // b + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, color); // b + return new Fruit(banana, color); throw new JsonException(); } @@ -213,7 +213,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs index 5db54ec72e55..46c3c3b25407 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FruitReq.cs @@ -152,10 +152,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); // b + return new FruitReq(appleReq); if (bananaReq != null) - return new FruitReq(bananaReq); // b + return new FruitReq(bananaReq); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index 0e98ab79c33c..b06867bb623a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -51,35 +51,35 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Apple /// [JsonIgnore] - public Option AppleOption { get; private set; } // option b + public Option AppleOption { get; private set; } /// /// Gets or Sets Apple /// - public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } /// /// Used to track the state of Banana /// [JsonIgnore] - public Option BananaOption { get; private set; } // option b + public Option BananaOption { get; private set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -185,7 +185,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve ? default : new Option(banana); - return new GmFruit(appleParsedValue, bananaParsedValue, color); // a + return new GmFruit(appleParsedValue, bananaParsedValue, color); } /// @@ -228,7 +228,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.ColorOption.IsSet) - writer.WriteString("color", gmFruit.Color); // 1 + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 98443b63f39f..a0068cc6781c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -48,7 +48,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } // d + public string PetType { get; set; } /// /// Gets or Sets additional properties @@ -145,7 +145,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - return new GrandparentAnimal(petType.Value!); // a + return new GrandparentAnimal(petType.Value!); } /// @@ -175,7 +175,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 + writer.WriteString("pet_type", grandparentAnimal.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 5e021cb539ee..005bc0c1da78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -50,25 +50,25 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } } // d + public string? Bar { get { return this. BarOption; } } /// /// Used to track the state of Foo /// [JsonIgnore] - public Option FooOption { get; } // option d + public Option FooOption { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string? Foo { get { return this. FooOption; } } // d + public string? Foo { get { return this. FooOption; } } /// /// Gets or Sets additional properties @@ -201,7 +201,7 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ if (foo.IsSet && foo.Value == null) throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); // a + return new HasOnlyReadOnly(bar, foo); } /// @@ -235,10 +235,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); if (hasOnlyReadOnly.BarOption.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + writer.WriteString("bar", hasOnlyReadOnly.Bar); if (hasOnlyReadOnly.FooOption.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 8f20110d9ab1..bea03f780087 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -48,13 +48,13 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] - public Option NullableMessageOption { get; private set; } // option d + public Option NullableMessageOption { get; private set; } /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d + public string? NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); // a + return new HealthCheckResult(nullableMessage); } /// @@ -164,7 +164,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessageOption.IsSet) if (healthCheckResult.NullableMessageOption.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index 79ae3c0e5e1c..378561b5e325 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -50,13 +50,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Returns the string presentation of the object @@ -147,7 +147,7 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); // a + return new IsoscelesTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -180,9 +180,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index edadd4f0d93d..c05bc6ebc004 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -48,13 +48,13 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] - public Option Var123ListOption { get; private set; } // option d + public Option Var123ListOption { get; private set; } /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d + public string? Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123List.IsSet && var123List.Value == null) throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); // a + return new List(var123List); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123ListOption.IsSet) - writer.WriteString("123-list", list.Var123List); // 1 + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index fd7a07b034a6..8aabb072d612 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -50,25 +50,25 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of EscapedLiteralString /// [JsonIgnore] - public Option EscapedLiteralStringOption { get; private set; } // option d + public Option EscapedLiteralStringOption { get; private set; } /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + public string? EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } /// /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] - public Option UnescapedLiteralStringOption { get; private set; } // option d + public Option UnescapedLiteralStringOption { get; private set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d + public string? UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -160,7 +160,7 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -194,10 +194,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); if (literalStringClass.EscapedLiteralStringOption.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); if (literalStringClass.UnescapedLiteralStringOption.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs index f95eca9e5523..40b4a549ca6c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Mammal.cs @@ -88,7 +88,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -225,13 +225,13 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className.Value!); // c + return new Mammal(pig, className.Value!); if (whale != null) - return new Mammal(whale, className.Value!); // c + return new Mammal(whale, className.Value!); if (zebra != null) - return new Mammal(zebra, className.Value!); // c + return new Mammal(zebra, className.Value!); throw new JsonException(); } @@ -278,7 +278,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); // 1 + writer.WriteString("className", mammal.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index c0e340a4d4df..aa1fa8f7b2f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -120,49 +120,49 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of DirectMap /// [JsonIgnore] - public Option?> DirectMapOption { get; private set; } // option d + public Option?> DirectMapOption { get; private set; } /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + public Dictionary? DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } /// /// Used to track the state of IndirectMap /// [JsonIgnore] - public Option?> IndirectMapOption { get; private set; } // option d + public Option?> IndirectMapOption { get; private set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + public Dictionary? IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } /// /// Used to track the state of MapMapOfString /// [JsonIgnore] - public Option>?> MapMapOfStringOption { get; private set; } // option d + public Option>?> MapMapOfStringOption { get; private set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + public Dictionary>? MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } /// /// Used to track the state of MapOfEnumString /// [JsonIgnore] - public Option?> MapOfEnumStringOption { get; private set; } // option d + public Option?> MapOfEnumStringOption { get; private set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d + public Dictionary? MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -274,7 +274,7 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -313,16 +313,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - if (mapTest.DirectMapOption.IsSet) // 14 + if (mapTest.DirectMapOption.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMapOption.IsSet) // 14 + if (mapTest.IndirectMapOption.IsSet) writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfStringOption.IsSet) // 14 + if (mapTest.MapMapOfStringOption.IsSet) writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumStringOption.IsSet) // 14 + if (mapTest.MapOfEnumStringOption.IsSet) writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index f9e442fece06..49785c2d53c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -54,49 +54,49 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of Map /// [JsonIgnore] - public Option?> MapOption { get; private set; } // option d + public Option?> MapOption { get; private set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + public Dictionary? Map { get { return this. MapOption; } set { this.MapOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Used to track the state of UuidWithPattern /// [JsonIgnore] - public Option UuidWithPatternOption { get; private set; } // option d + public Option UuidWithPatternOption { get; private set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } /// /// Gets or Sets additional properties @@ -220,7 +220,7 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); } /// @@ -251,16 +251,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); // 11 + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index 888ecd59ce95..74b68e721d9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -50,25 +50,25 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string? VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -161,7 +161,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name); // a + return new Model200Response(varClass, name); } /// @@ -192,10 +192,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); if (model200Response.VarClassOption.IsSet) - writer.WriteString("class", model200Response.VarClass); // 1 + writer.WriteString("class", model200Response.VarClass); if (model200Response.NameOption.IsSet) - writer.WriteNumber("name", model200Response.NameOption.Value!.Value); // 3 + writer.WriteNumber("name", model200Response.NameOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index a94f395236c9..429dd896ef32 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -48,13 +48,13 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] - public Option VarClientOption { get; private set; } // option d + public Option VarClientOption { get; private set; } /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d + public string? VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (varClient.IsSet && varClient.Value == null) throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); // a + return new ModelClient(varClient); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClientOption.IsSet) - writer.WriteString("client", modelClient.VarClient); // 1 + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index daabbe58b6c0..6db71db5a360 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -54,43 +54,43 @@ public Name(int varName, Option property = default, Option snakeC /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } // d + public int VarName { get; set; } /// /// Used to track the state of Property /// [JsonIgnore] - public Option PropertyOption { get; private set; } // option d + public Option PropertyOption { get; private set; } /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + public string? Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } /// /// Used to track the state of SnakeCase /// [JsonIgnore] - public Option SnakeCaseOption { get; } // option d + public Option SnakeCaseOption { get; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + public int? SnakeCase { get { return this. SnakeCaseOption; } } /// /// Used to track the state of Var123Number /// [JsonIgnore] - public Option Var123NumberOption { get; } // option d + public Option Var123NumberOption { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int? Var123Number { get { return this. Var123NumberOption; } } // d + public int? Var123Number { get { return this. Var123NumberOption; } } /// /// Gets or Sets additional properties @@ -245,7 +245,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123Number.IsSet && var123Number.Value == null) throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value!.Value!, property, snakeCase, var123Number); // a + return new Name(varName.Value!.Value!, property, snakeCase, var123Number); } /// @@ -275,16 +275,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.PropertyOption.IsSet && name.Property == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); // 3 + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) - writer.WriteString("property", name.Property); // 1 + writer.WriteString("property", name.Property); if (name.SnakeCaseOption.IsSet) - writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); // 3 + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value!.Value); if (name.Var123NumberOption.IsSet) - writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); // 3 + writer.WriteNumber("123Number", name.Var123NumberOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index 61f336825040..0be2516e5112 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -50,13 +50,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } // d + public List> AObjVariableobject { get; set; } /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } // d + public int PkiNotificationtestID { get; set; } /// /// Gets or Sets additional properties @@ -156,7 +156,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); // a + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value!, pkiNotificationtestID.Value!.Value!); } /// @@ -187,8 +187,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElemen throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 3b43f4fb1619..54fae9389232 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -70,145 +70,145 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] - public Option?> ArrayItemsNullableOption { get; private set; } // option d + public Option?> ArrayItemsNullableOption { get; private set; } /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] - public Option?> ObjectItemsNullableOption { get; private set; } // option d + public Option?> ObjectItemsNullableOption { get; private set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] - public Option?> ArrayAndItemsNullablePropOption { get; private set; } // option d + public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ArrayNullableProp /// [JsonIgnore] - public Option?> ArrayNullablePropOption { get; private set; } // option d + public Option?> ArrayNullablePropOption { get; private set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + public List? ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } /// /// Used to track the state of BooleanProp /// [JsonIgnore] - public Option BooleanPropOption { get; private set; } // option d + public Option BooleanPropOption { get; private set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } /// /// Used to track the state of DateProp /// [JsonIgnore] - public Option DatePropOption { get; private set; } // option d + public Option DatePropOption { get; private set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } /// /// Used to track the state of DatetimeProp /// [JsonIgnore] - public Option DatetimePropOption { get; private set; } // option d + public Option DatetimePropOption { get; private set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } /// /// Used to track the state of IntegerProp /// [JsonIgnore] - public Option IntegerPropOption { get; private set; } // option d + public Option IntegerPropOption { get; private set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } /// /// Used to track the state of NumberProp /// [JsonIgnore] - public Option NumberPropOption { get; private set; } // option d + public Option NumberPropOption { get; private set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } /// /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] - public Option?> ObjectAndItemsNullablePropOption { get; private set; } // option d + public Option?> ObjectAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ObjectNullableProp /// [JsonIgnore] - public Option?> ObjectNullablePropOption { get; private set; } // option d + public Option?> ObjectNullablePropOption { get; private set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + public Dictionary? ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } /// /// Used to track the state of StringProp /// [JsonIgnore] - public Option StringPropOption { get; private set; } // option d + public Option StringPropOption { get; private set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d + public string? StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } /// /// Gets or Sets additional properties @@ -382,7 +382,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -415,13 +415,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + if (nullableClass.ArrayItemsNullableOption.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + if (nullableClass.ObjectItemsNullableOption.IsSet) writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("array_and_items_nullable_prop"); @@ -429,7 +429,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { writer.WritePropertyName("array_nullable_prop"); @@ -439,35 +439,35 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("array_nullable_prop"); if (nullableClass.BooleanPropOption.IsSet) if (nullableClass.BooleanPropOption.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value!.Value); else writer.WriteNull("boolean_prop"); if (nullableClass.DatePropOption.IsSet) if (nullableClass.DatePropOption.Value != null) - writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); // 4 + writer.WriteString("date_prop", nullableClass.DatePropOption.Value!.Value.ToString(DatePropFormat)); else writer.WriteNull("date_prop"); if (nullableClass.DatetimePropOption.IsSet) if (nullableClass.DatetimePropOption.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); // 5 + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value!.Value.ToString(DatetimePropFormat)); else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerPropOption.IsSet) if (nullableClass.IntegerPropOption.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value!.Value); else writer.WriteNull("integer_prop"); if (nullableClass.NumberPropOption.IsSet) if (nullableClass.NumberPropOption.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); // 3 + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value!.Value); else writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -475,7 +475,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { writer.WritePropertyName("object_nullable_prop"); @@ -485,7 +485,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("object_nullable_prop"); if (nullableClass.StringPropOption.IsSet) if (nullableClass.StringPropOption.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp); // 1 + writer.WriteString("string_prop", nullableClass.StringProp); else writer.WriteNull("string_prop"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 5a05b18cf2f4..9134874441c1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -48,14 +48,14 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); // a + return new NullableGuidClass(uuid); } /// @@ -166,7 +166,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.UuidOption.IsSet) if (nullableGuidClass.UuidOption.Value != null) - writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); // 11 + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value!.Value); else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs index 5946a3a86c89..863a29111dd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableShape.cs @@ -71,7 +71,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -202,10 +202,10 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType.Value!); // c + return new NullableShape(quadrilateral, shapeType.Value!); if (triangle != null) - return new NullableShape(triangle, shapeType.Value!); // c + return new NullableShape(triangle, shapeType.Value!); throw new JsonException(); } @@ -247,7 +247,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); // 1 + writer.WriteString("shapeType", nullableShape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index bc60bde31ce5..5a7c5a172555 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -48,13 +48,13 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] - public Option JustNumberOption { get; private set; } // option d + public Option JustNumberOption { get; private set; } /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justNumber.IsSet && justNumber.Value == null) throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber); // a + return new NumberOnly(justNumber); } /// @@ -167,7 +167,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { if (numberOnly.JustNumberOption.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); // 3 + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 4c1790a874b3..d027881a4e34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -54,52 +54,52 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] - public Option?> BarsOption { get; private set; } // option d + public Option?> BarsOption { get; private set; } /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + public List? Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } /// /// Used to track the state of DeprecatedRef /// [JsonIgnore] - public Option DeprecatedRefOption { get; private set; } // option d + public Option DeprecatedRefOption { get; private set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + public DeprecatedObject? DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public string? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -210,7 +210,7 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); } /// @@ -246,17 +246,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + if (objectWithDeprecatedFields.BarsOption.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.IdOption.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); if (objectWithDeprecatedFields.UuidOption.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs index 431635c1feb2..a0a54c250670 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OneOfString.cs @@ -124,10 +124,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index bbd856716485..e9034545ad8d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -139,75 +139,75 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of PetId /// [JsonIgnore] - public Option PetIdOption { get; private set; } // option d + public Option PetIdOption { get; private set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } /// /// Used to track the state of Quantity /// [JsonIgnore] - public Option QuantityOption { get; private set; } // option d + public Option QuantityOption { get; private set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } /// /// Used to track the state of ShipDate /// [JsonIgnore] - public Option ShipDateOption { get; private set; } // option d + public Option ShipDateOption { get; private set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } /// /// Used to track the state of Complete /// [JsonIgnore] - public Option CompleteOption { get; private set; } // option d + public Option CompleteOption { get; private set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } /// /// Gets or Sets additional properties @@ -343,7 +343,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (complete.IsSet && complete.Value == null) throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id, petId, quantity, shipDate, status, complete); // a + return new Order(id, petId, quantity, shipDate, status, complete); } /// @@ -371,25 +371,25 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { if (order.IdOption.IsSet) - writer.WriteNumber("id", order.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", order.IdOption.Value!.Value); if (order.PetIdOption.IsSet) - writer.WriteNumber("petId", order.PetIdOption.Value!.Value); // 3 + writer.WriteNumber("petId", order.PetIdOption.Value!.Value); if (order.QuantityOption.IsSet) - writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); // 3 + writer.WriteNumber("quantity", order.QuantityOption.Value!.Value); if (order.ShipDateOption.IsSet) - writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); // 5 + writer.WriteString("shipDate", order.ShipDateOption.Value!.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); // 7 + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value!.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); // 2 + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index cd9235a8e800..1357183a90c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -52,37 +52,37 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] - public Option MyBooleanOption { get; private set; } // option d + public Option MyBooleanOption { get; private set; } /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } /// /// Used to track the state of MyNumber /// [JsonIgnore] - public Option MyNumberOption { get; private set; } // option d + public Option MyNumberOption { get; private set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } /// /// Used to track the state of MyString /// [JsonIgnore] - public Option MyStringOption { get; private set; } // option d + public Option MyStringOption { get; private set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d + public string? MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -184,7 +184,7 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type if (myString.IsSet && myString.Value == null) throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean, myNumber, myString); // a + return new OuterComposite(myBoolean, myNumber, myString); } /// @@ -215,13 +215,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); if (outerComposite.MyBooleanOption.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); // 2 + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value!.Value); if (outerComposite.MyNumberOption.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); // 3 + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value!.Value); if (outerComposite.MyStringOption.IsSet) - writer.WriteString("my_string", outerComposite.MyString); // 1 + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs index ff6c5ba92473..de4aa64ceab3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ParentPet.cs @@ -111,7 +111,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - return new ParentPet(petType.Value!); // a + return new ParentPet(petType.Value!); } /// @@ -141,7 +141,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); // 1 + writer.WriteString("pet_type", parentPet.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 639017a1f196..6065c8956ac3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -139,63 +139,63 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Gets or Sets Name /// /// doggie [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Gets or Sets PhotoUrls /// [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } // d + public List PhotoUrls { get; set; } /// /// Used to track the state of Category /// [JsonIgnore] - public Option CategoryOption { get; private set; } // option d + public Option CategoryOption { get; private set; } /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d + public Category? Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Tags /// [JsonIgnore] - public Option?> TagsOption { get; private set; } // option d + public Option?> TagsOption { get; private set; } /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d + public List? Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } /// /// Gets or Sets additional properties @@ -331,7 +331,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (tags.IsSet && tags.Value == null) throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); // a + return new Pet(name.Value!, photoUrls.Value!, category, id, status, tags); } /// @@ -370,23 +370,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.TagsOption.IsSet && pet.Tags == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); // 1 + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 - if (pet.CategoryOption.IsSet) // 14 + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); if (pet.IdOption.IsSet) - writer.WriteNumber("id", pet.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", pet.IdOption.Value!.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); // 7 + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value!.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.TagsOption.IsSet) // 14 + if (pet.TagsOption.IsSet) writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs index c426e2e92f11..727999c59285 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pig.cs @@ -71,7 +71,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -202,10 +202,10 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className.Value!); // c + return new Pig(basquePig, className.Value!); if (danishPig != null) - return new Pig(danishPig, className.Value!); // c + return new Pig(danishPig, className.Value!); throw new JsonException(); } @@ -247,7 +247,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); // 1 + writer.WriteString("className", pig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index ec8a8a92cbb1..1333f4a725d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -197,16 +197,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); // b + return new PolymorphicProperty(varBool); if (varString != null) - return new PolymorphicProperty(varString); // b + return new PolymorphicProperty(varString); if (varObject != null) - return new PolymorphicProperty(varObject); // b + return new PolymorphicProperty(varObject); if (list != null) - return new PolymorphicProperty(list); // b + return new PolymorphicProperty(list); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs index c00c8c241f0e..5b20c6e30689 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -71,7 +71,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -202,10 +202,10 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value!); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); // c + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value!); throw new JsonException(); } @@ -247,7 +247,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 4c00c08e2e7c..9a15b8828a38 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -48,7 +48,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T if (quadrilateralType.IsSet && quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType.Value!); // a + return new QuadrilateralInterface(quadrilateralType.Value!); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 38d53b80b444..a0386a20ae96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -50,25 +50,25 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string? Bar { get { return this. BarOption; } } // d + public string? Bar { get { return this. BarOption; } } /// /// Used to track the state of Baz /// [JsonIgnore] - public Option BazOption { get; private set; } // option d + public Option BazOption { get; private set; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d + public string? Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } /// /// Gets or Sets additional properties @@ -198,7 +198,7 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (baz.IsSet && baz.Value == null) throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); // a + return new ReadOnlyFirst(bar, baz); } /// @@ -232,10 +232,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); if (readOnlyFirst.BarOption.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar); // 1 + writer.WriteString("bar", readOnlyFirst.Bar); if (readOnlyFirst.BazOption.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz); // 1 + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index e9dbe252e471..c05f3fc4a077 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -193,7 +193,7 @@ public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnulla /// Gets or Sets RequiredNotnullableEnumInteger /// [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } /// /// Defines RequiredNotnullableEnumIntegerOnly @@ -258,7 +258,7 @@ public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotn /// Gets or Sets RequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNotnullableEnumString @@ -414,13 +414,13 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul /// Gets or Sets RequiredNotnullableEnumString /// [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } /// /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNotnullableEnumInteger @@ -485,13 +485,13 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumInteger /// [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumIntegerOnly @@ -556,13 +556,13 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumString @@ -718,25 +718,25 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumString /// [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines RequiredNullableEnumInteger @@ -801,7 +801,7 @@ public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnu /// Gets or Sets RequiredNullableEnumInteger /// [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// /// Defines RequiredNullableEnumIntegerOnly @@ -866,7 +866,7 @@ public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullabl /// Gets or Sets RequiredNullableEnumIntegerOnly /// [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNullableEnumString @@ -1025,13 +1025,13 @@ public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromS /// Gets or Sets RequiredNullableEnumString /// [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNullableEnumInteger @@ -1096,13 +1096,13 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumInteger /// [JsonPropertyName("notrequired_nullable_enum_integer")] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNullableEnumIntegerOnly @@ -1167,13 +1167,13 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumIntegerOnly /// [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNullableEnumString @@ -1332,281 +1332,281 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] - public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumString /// [JsonPropertyName("notrequired_nullable_enum_string")] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } /// /// Gets or Sets RequiredNotNullableDateProp /// [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } // d + public DateTime RequiredNotNullableDateProp { get; set; } /// /// Gets or Sets RequiredNotnullableArrayOfString /// [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } // d + public List RequiredNotnullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNotnullableBooleanProp /// [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } // d + public bool RequiredNotnullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNotnullableDatetimeProp /// [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + public DateTime RequiredNotnullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNotnullableStringProp /// [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } // d + public string RequiredNotnullableStringProp { get; set; } /// /// Gets or Sets RequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } // d + public Guid RequiredNotnullableUuid { get; set; } /// /// Gets or Sets RequiredNotnullableintegerProp /// [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } // d + public int RequiredNotnullableintegerProp { get; set; } /// /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] - public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableDateProp /// [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableintegerProp /// [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] - public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableArrayOfString /// [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableBooleanProp /// [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableDatetimeProp /// [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] - public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableStringProp /// [JsonPropertyName("notrequired_notnullable_string_prop")] - public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] - public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + public Option NotrequiredNotnullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Gets or Sets RequiredNullableArrayOfString /// [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } // d + public List? RequiredNullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNullableBooleanProp /// [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } // d + public bool? RequiredNullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNullableDateProp /// [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } // d + public DateTime? RequiredNullableDateProp { get; set; } /// /// Gets or Sets RequiredNullableDatetimeProp /// [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } // d + public DateTime? RequiredNullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNullableIntegerProp /// [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } // d + public int? RequiredNullableIntegerProp { get; set; } /// /// Gets or Sets RequiredNullableStringProp /// [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } // d + public string? RequiredNullableStringProp { get; set; } /// /// Gets or Sets RequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } // d + public Guid? RequiredNullableUuid { get; set; } /// /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] - public Option NotRequiredNullableDatePropOption { get; private set; } // option d + public Option NotRequiredNullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableDateProp /// [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] - public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableIntegerProp /// [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] - public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableArrayOfString /// [JsonPropertyName("notrequired_nullable_array_of_string")] - public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + public List? NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableBooleanProp /// [JsonPropertyName("notrequired_nullable_boolean_prop")] - public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableDatetimeProp /// [JsonPropertyName("notrequired_nullable_datetime_prop")] - public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] - public Option NotrequiredNullableStringPropOption { get; private set; } // option d + public Option NotrequiredNullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableStringProp /// [JsonPropertyName("notrequired_nullable_string_prop")] - public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + public string? NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] - public Option NotrequiredNullableUuidOption { get; private set; } // option d + public Option NotrequiredNullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_nullable_uuid")] - public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -2122,7 +2122,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2161,72 +2161,72 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else writer.WriteNull("required_notnullable_enum_string"); - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); // 7 + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else writer.WriteNull("notrequired_notnullable_enum_string"); - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); // 10 b + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); - if (requiredClass.RequiredNullableArrayOfString != null) // 12 + if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2234,46 +2234,46 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_array_of_string"); if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); else writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); else writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); else writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); else writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); else writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); // 7 + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString!.Value); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); else writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); else @@ -2281,28 +2281,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); // 3 + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value!.Value); else writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2312,51 +2312,51 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_array_of_string"); if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); // 2 + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value!.Value); else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value!.Value.ToString(NotrequiredNullableDatetimePropFormat)); else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value!.Value)); else writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value!.Value)); else writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); // 7 + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value!.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) // 10 a + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption!.Value != null) { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); // 10 c + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value!.Value); writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); if (requiredClass.NotrequiredNullableStringPropOption.IsSet) if (requiredClass.NotrequiredNullableStringPropOption.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); else writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuidOption.IsSet) if (requiredClass.NotrequiredNullableUuidOption.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); // 11 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value!.Value); else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index 1d5654053d85..c458446ead1d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -48,13 +48,13 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] - public Option VarReturnOption { get; private set; } // option d + public Option VarReturnOption { get; private set; } /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (varReturn.IsSet && varReturn.Value == null) throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn); // a + return new Return(varReturn); } /// @@ -167,7 +167,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { if (varReturn.VarReturnOption.IsSet) - writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); // 3 + writer.WriteNumber("return", varReturn.VarReturnOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index b0eb391cbe3d..a3d47d1fe672 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -50,25 +50,25 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] - public Option RoleOption { get; private set; } // option d + public Option RoleOption { get; private set; } /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + public RolesReportsHashRole? Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } /// /// Used to track the state of RoleUuid /// [JsonIgnore] - public Option RoleUuidOption { get; private set; } // option d + public Option RoleUuidOption { get; private set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -162,7 +162,7 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty if (roleUuid.IsSet && roleUuid.Value == null) throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid); // a + return new RolesReportsHash(role, roleUuid); } /// @@ -192,11 +192,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - if (rolesReportsHash.RoleOption.IsSet) // 14 + if (rolesReportsHash.RoleOption.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuidOption.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); // 11 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 6dde1d4a12a6..4f87bbbfea38 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -48,13 +48,13 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); // a + return new RolesReportsHashRole(name); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.NameOption.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name); // 1 + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 864b36a500ad..4cdb6d4aa46d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -50,13 +50,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); // a + return new ScaleneTriangle(shapeType.Value!, triangleType.Value!); } /// @@ -187,9 +187,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs index d8f653dd1b1b..f2e26ef8c5ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Shape.cs @@ -71,7 +71,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -202,10 +202,10 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType.Value!); // c + return new Shape(quadrilateral, shapeType.Value!); if (triangle != null) - return new Shape(triangle, shapeType.Value!); // c + return new Shape(triangle, shapeType.Value!); throw new JsonException(); } @@ -247,7 +247,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); // 1 + writer.WriteString("shapeType", shape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs index 339f2a8e9aea..2780ac574a8d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -48,7 +48,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - return new ShapeInterface(shapeType.Value!); // a + return new ShapeInterface(shapeType.Value!); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 + writer.WriteString("shapeType", shapeInterface.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 561d71d64982..b7c92c1f884e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -71,7 +71,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -202,10 +202,10 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType.Value!); // c + return new ShapeOrNull(quadrilateral, shapeType.Value!); if (triangle != null) - return new ShapeOrNull(triangle, shapeType.Value!); // c + return new ShapeOrNull(triangle, shapeType.Value!); throw new JsonException(); } @@ -247,7 +247,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 093dfadef92a..279d0b1faa0b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -50,13 +50,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); // a + return new SimpleQuadrilateral(quadrilateralType.Value!, shapeType.Value!); } /// @@ -187,9 +187,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index c21058c299bb..cd382f12d5bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -50,25 +50,25 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] - public Option VarSpecialModelNameOption { get; private set; } // option d + public Option VarSpecialModelNameOption { get; private set; } /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + public string? VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } /// /// Used to track the state of SpecialPropertyName /// [JsonIgnore] - public Option SpecialPropertyNameOption { get; private set; } // option d + public Option SpecialPropertyNameOption { get; private set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } /// /// Gets or Sets additional properties @@ -161,7 +161,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty if (specialPropertyName.IsSet && specialPropertyName.Value == null) throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName); // a + return new SpecialModelName(varSpecialModelName, specialPropertyName); } /// @@ -192,10 +192,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); if (specialModelName.VarSpecialModelNameOption.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); if (specialModelName.SpecialPropertyNameOption.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); // 3 + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index 6848c075604a..d50223cb2785 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -50,25 +50,25 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -161,7 +161,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id, name); // a + return new Tag(id, name); } /// @@ -192,10 +192,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); if (tag.IdOption.IsSet) - writer.WriteNumber("id", tag.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", tag.IdOption.Value!.Value); if (tag.NameOption.IsSet) - writer.WriteString("name", tag.Name); // 1 + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index bbf3a175c3be..c6e694610c28 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -48,13 +48,13 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] - public Option ValueOption { get; private set; } // option d + public Option ValueOption { get; private set; } /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d + public string? Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso if (value.IsSet && value.Value == null) throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); // a + return new TestCollectionEndingWithWordList(value); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.ValueOption.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 7daab5244c2e..33d488bef177 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -48,13 +48,13 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] - public Option?> TestCollectionEndingWithWordListOption { get; private set; } // option d + public Option?> TestCollectionEndingWithWordListOption { get; private set; } /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d + public List? TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index d22ed876096d..ef001ea5c3f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -48,13 +48,13 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option somePropert /// Used to track the state of SomeProperty /// [JsonIgnore] - public Option SomePropertyOption { get; private set; } // option d + public Option SomePropertyOption { get; private set; } /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d + public string? SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -149,7 +149,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR if (someProperty.IsSet && someProperty.Value == null) throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -180,7 +180,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs index 760b3ae0b750..303afee787db 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Triangle.cs @@ -88,7 +88,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -225,13 +225,13 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType.Value!); // c + return new Triangle(equilateralTriangle, triangleType.Value!); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType.Value!); // c + return new Triangle(isoscelesTriangle, triangleType.Value!); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType.Value!); // c + return new Triangle(scaleneTriangle, triangleType.Value!); throw new JsonException(); } @@ -278,7 +278,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); // 1 + writer.WriteString("triangleType", triangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs index c5c33c6a0fad..f5bb5d307c83 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -48,7 +48,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - return new TriangleInterface(triangleType.Value!); // a + return new TriangleInterface(triangleType.Value!); } /// @@ -165,7 +165,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 + writer.WriteString("triangleType", triangleInterface.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 757cda5bf483..69039652565e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -70,150 +70,150 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Email /// [JsonIgnore] - public Option EmailOption { get; private set; } // option d + public Option EmailOption { get; private set; } /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + public string? Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } /// /// Used to track the state of FirstName /// [JsonIgnore] - public Option FirstNameOption { get; private set; } // option d + public Option FirstNameOption { get; private set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of LastName /// [JsonIgnore] - public Option LastNameOption { get; private set; } // option d + public Option LastNameOption { get; private set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } /// /// Used to track the state of Password /// [JsonIgnore] - public Option PasswordOption { get; private set; } // option d + public Option PasswordOption { get; private set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + public string? Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } /// /// Used to track the state of Phone /// [JsonIgnore] - public Option PhoneOption { get; private set; } // option d + public Option PhoneOption { get; private set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + public string? Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } /// /// Used to track the state of UserStatus /// [JsonIgnore] - public Option UserStatusOption { get; private set; } // option d + public Option UserStatusOption { get; private set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } /// /// Used to track the state of Username /// [JsonIgnore] - public Option UsernameOption { get; private set; } // option d + public Option UsernameOption { get; private set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } /// /// Used to track the state of AnyTypeProp /// [JsonIgnore] - public Option AnyTypePropOption { get; private set; } // option d + public Option AnyTypePropOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } /// /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] - public Option AnyTypePropNullableOption { get; private set; } // option d + public Option AnyTypePropNullableOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } /// /// Gets or Sets additional properties @@ -382,7 +382,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -431,33 +431,33 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); if (user.EmailOption.IsSet) - writer.WriteString("email", user.Email); // 1 + writer.WriteString("email", user.Email); if (user.FirstNameOption.IsSet) - writer.WriteString("firstName", user.FirstName); // 1 + writer.WriteString("firstName", user.FirstName); if (user.IdOption.IsSet) - writer.WriteNumber("id", user.IdOption.Value!.Value); // 3 + writer.WriteNumber("id", user.IdOption.Value!.Value); if (user.LastNameOption.IsSet) - writer.WriteString("lastName", user.LastName); // 1 + writer.WriteString("lastName", user.LastName); - if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsOption.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.PasswordOption.IsSet) - writer.WriteString("password", user.Password); // 1 + writer.WriteString("password", user.Password); if (user.PhoneOption.IsSet) - writer.WriteString("phone", user.Phone); // 1 + writer.WriteString("phone", user.Phone); if (user.UserStatusOption.IsSet) - writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); // 3 + writer.WriteNumber("userStatus", user.UserStatusOption.Value!.Value); if (user.UsernameOption.IsSet) - writer.WriteString("username", user.Username); // 1 + writer.WriteString("username", user.Username); - if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) { writer.WritePropertyName("anyTypeProp"); @@ -465,7 +465,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.IsSet) if (user.AnyTypePropNullableOption.Value != null) { writer.WritePropertyName("anyTypePropNullable"); @@ -473,7 +473,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) { writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 2d09d1129846..9950a0bdc194 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -52,31 +52,31 @@ public Whale(string className, Option hasBaleen = default, Option /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of HasBaleen /// [JsonIgnore] - public Option HasBaleenOption { get; private set; } // option d + public Option HasBaleenOption { get; private set; } /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } /// /// Used to track the state of HasTeeth /// [JsonIgnore] - public Option HasTeethOption { get; private set; } // option d + public Option HasTeethOption { get; private set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } /// /// Gets or Sets additional properties @@ -181,7 +181,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (hasTeeth.IsSet && hasTeeth.Value == null) throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className.Value!, hasBaleen, hasTeeth); // a + return new Whale(className.Value!, hasBaleen, hasTeeth); } /// @@ -211,13 +211,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); // 1 + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); // 2 + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value!.Value); if (whale.HasTeethOption.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); // 2 + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index a3c13825b133..7844dc6335cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -130,19 +130,19 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option a + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -250,7 +250,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className.Value!, type); // a + return new Zebra(className.Value!, type); } /// @@ -280,9 +280,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); // 1 + writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); // 7 + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value!.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index dd8263762e14..23abfb31bf3f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -114,13 +114,13 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] - public Option ZeroBasedEnumOption { get; private set; } // option a + public Option ZeroBasedEnumOption { get; private set; } /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -206,7 +206,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum); // a + return new ZeroBasedEnumClass(zeroBasedEnum); } /// @@ -233,7 +233,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); // 7 + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value!.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 7e98807f5003..4c4b7e6e697a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -46,13 +46,13 @@ public Activity(Option [JsonIgnore] - public Option>> ActivityOutputsOption { get; private set; } // option d + public Option>> ActivityOutputsOption { get; private set; } /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } // d + public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (activityOutputs.IsSet && activityOutputs.Value == null) throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); // a + return new Activity(activityOutputs); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - if (activity.ActivityOutputsOption.IsSet) // 14 + if (activity.ActivityOutputsOption.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 03491596e433..7fb0642c8000 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -48,25 +48,25 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop1 /// [JsonIgnore] - public Option Prop1Option { get; private set; } // option d + public Option Prop1Option { get; private set; } /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } // d + public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new(value); } } /// /// Used to track the state of Prop2 /// [JsonIgnore] - public Option Prop2Option { get; private set; } // option d + public Option Prop2Option { get; private set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } // d + public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 if (prop2.IsSet && prop2.Value == null) throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); // a + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -193,9 +193,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); if (activityOutputElementRepresentation.Prop1Option.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + if (activityOutputElementRepresentation.Prop2Option.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 4a31df84037e..5c6d6080444a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -60,98 +60,98 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] - public Option EmptyMapOption { get; private set; } // option d + public Option EmptyMapOption { get; private set; } /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } // d + public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new(value); } } /// /// Used to track the state of MapOfMapProperty /// [JsonIgnore] - public Option>> MapOfMapPropertyOption { get; private set; } // option d + public Option>> MapOfMapPropertyOption { get; private set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } // d + public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new(value); } } /// /// Used to track the state of MapProperty /// [JsonIgnore] - public Option> MapPropertyOption { get; private set; } // option d + public Option> MapPropertyOption { get; private set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } // d + public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } // d + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } // d + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 /// [JsonIgnore] - public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } // d + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesString /// [JsonIgnore] - public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } // d + public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } /// /// Used to track the state of Anytype1 /// [JsonIgnore] - public Option Anytype1Option { get; private set; } // option d + public Option Anytype1Option { get; private set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } // d + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } /// /// Gets or Sets additional properties @@ -296,7 +296,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -344,28 +344,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + if (additionalPropertiesClass.EmptyMapOption.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapPropertyOption.IsSet) writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { writer.WritePropertyName("anytype_1"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index f520a695290e..de2c9fad7b12 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -48,19 +48,19 @@ public Animal(string className, Option color = default) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Gets or Sets additional properties @@ -165,7 +165,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className.Value, color); // a + return new Animal(className.Value, color); } /// @@ -198,10 +198,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.ColorOption.IsSet && animal.Color == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); // 1 + writer.WriteString("className", animal.ClassName); if (animal.ColorOption.IsSet) - writer.WriteString("color", animal.Color); // 1 + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 29b967d25965..d9c08e85ac84 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -50,37 +50,37 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Code /// [JsonIgnore] - public Option CodeOption { get; private set; } // option d + public Option CodeOption { get; private set; } /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } // d + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new(value); } } /// /// Used to track the state of Message /// [JsonIgnore] - public Option MessageOption { get; private set; } // option d + public Option MessageOption { get; private set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } // d + public string Message { get { return this. MessageOption; } set { this.MessageOption = new(value); } } /// /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option d + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d + public string Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets additional properties @@ -181,7 +181,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code, message, type); // a + return new ApiResponse(code, message, type); } /// @@ -215,13 +215,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); if (apiResponse.CodeOption.IsSet) - writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); // 3 + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); if (apiResponse.MessageOption.IsSet) - writer.WriteString("message", apiResponse.Message); // 1 + writer.WriteString("message", apiResponse.Message); if (apiResponse.TypeOption.IsSet) - writer.WriteString("type", apiResponse.Type); // 1 + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 3262ebdc682d..0a7e8d15b04c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -50,37 +50,37 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of ColorCode /// [JsonIgnore] - public Option ColorCodeOption { get; private set; } // option d + public Option ColorCodeOption { get; private set; } /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } // d + public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new(value); } } /// /// Used to track the state of Cultivar /// [JsonIgnore] - public Option CultivarOption { get; private set; } // option d + public Option CultivarOption { get; private set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } // d + public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new(value); } } /// /// Used to track the state of Origin /// [JsonIgnore] - public Option OriginOption { get; private set; } // option d + public Option OriginOption { get; private set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } // d + public string Origin { get { return this. OriginOption; } set { this.OriginOption = new(value); } } /// /// Gets or Sets additional properties @@ -210,7 +210,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (origin.IsSet && origin.Value == null) throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); // a + return new Apple(colorCode, cultivar, origin); } /// @@ -247,13 +247,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); if (apple.ColorCodeOption.IsSet) - writer.WriteString("color_code", apple.ColorCode); // 1 + writer.WriteString("color_code", apple.ColorCode); if (apple.CultivarOption.IsSet) - writer.WriteString("cultivar", apple.Cultivar); // 1 + writer.WriteString("cultivar", apple.Cultivar); if (apple.OriginOption.IsSet) - writer.WriteString("origin", apple.Origin); // 1 + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index 675c8f332544..e8682a7be3fb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -48,19 +48,19 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } // d + public string Cultivar { get; set; } /// /// Used to track the state of Mealy /// [JsonIgnore] - public Option MealyOption { get; private set; } // option d + public Option MealyOption { get; private set; } /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } // d + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new(value); } } /// /// Returns the string presentation of the object @@ -149,7 +149,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (mealy.IsSet && mealy.Value == null) throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar.Value, mealy); // a + return new AppleReq(cultivar.Value, mealy); } /// @@ -179,10 +179,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); // 1 + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) - writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); // 2 + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 2705524a85cc..dab704b88f64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -46,13 +46,13 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] - public Option>> ArrayArrayNumberOption { get; private set; } // option d + public Option>> ArrayArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } // d + public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ea924dc384f8..ef15a2678e13 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -46,13 +46,13 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] - public Option> ArrayNumberOption { get; private set; } // option d + public Option> ArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } // d + public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t if (arrayNumber.IsSet && arrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); // a + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index d7b0eef4ae79..7132885ebf47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -50,37 +50,37 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] - public Option>> ArrayArrayOfIntegerOption { get; private set; } // option d + public Option>> ArrayArrayOfIntegerOption { get; private set; } /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } // d + public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new(value); } } /// /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] - public Option>> ArrayArrayOfModelOption { get; private set; } // option d + public Option>> ArrayArrayOfModelOption { get; private set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } // d + public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new(value); } } /// /// Used to track the state of ArrayOfString /// [JsonIgnore] - public Option> ArrayOfStringOption { get; private set; } // option d + public Option> ArrayOfStringOption { get; private set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } // d + public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -183,7 +183,7 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (arrayOfString.IsSet && arrayOfString.Value == null) throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -219,13 +219,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfModelOption.IsSet) writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfStringOption.IsSet) // 14 + if (arrayTest.ArrayOfStringOption.IsSet) writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index 8cf5fb88f34a..a7591df666bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -46,13 +46,13 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] - public Option LengthCmOption { get; private set; } // option d + public Option LengthCmOption { get; private set; } /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } // d + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (lengthCm.IsSet && lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm); // a + return new Banana(lengthCm); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.LengthCmOption.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); // 3 + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index 3cea251bb36a..f796812969ec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -48,19 +48,19 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } // d + public decimal LengthCm { get; set; } /// /// Used to track the state of Sweet /// [JsonIgnore] - public Option SweetOption { get; private set; } // option d + public Option SweetOption { get; private set; } /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } // d + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new(value); } } /// /// Returns the string presentation of the object @@ -150,7 +150,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (sweet.IsSet && sweet.Value == null) throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value.Value, sweet); // a + return new BananaReq(lengthCm.Value.Value, sweet); } /// @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) - writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); // 2 + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs index 3c2aaf08e492..53c20a25cd10 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -46,7 +46,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - return new BasquePig(className.Value); // a + return new BasquePig(className.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); // 1 + writer.WriteString("className", basquePig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index f38b28e930a9..f2a97bef03a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -56,74 +56,74 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of ATT_NAME /// [JsonIgnore] - public Option ATT_NAMEOption { get; private set; } // option d + public Option ATT_NAMEOption { get; private set; } /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } // d + public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new(value); } } /// /// Used to track the state of CapitalCamel /// [JsonIgnore] - public Option CapitalCamelOption { get; private set; } // option d + public Option CapitalCamelOption { get; private set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } // d + public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new(value); } } /// /// Used to track the state of CapitalSnake /// [JsonIgnore] - public Option CapitalSnakeOption { get; private set; } // option d + public Option CapitalSnakeOption { get; private set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } // d + public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new(value); } } /// /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] - public Option SCAETHFlowPointsOption { get; private set; } // option d + public Option SCAETHFlowPointsOption { get; private set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } // d + public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new(value); } } /// /// Used to track the state of SmallCamel /// [JsonIgnore] - public Option SmallCamelOption { get; private set; } // option d + public Option SmallCamelOption { get; private set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } // d + public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new(value); } } /// /// Used to track the state of SmallSnake /// [JsonIgnore] - public Option SmallSnakeOption { get; private set; } // option d + public Option SmallSnakeOption { get; private set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } // d + public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new(value); } } /// /// Gets or Sets additional properties @@ -247,7 +247,7 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type if (smallSnake.IsSet && smallSnake.Value == null) throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -293,22 +293,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); if (capitalization.ATT_NAMEOption.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); if (capitalization.CapitalCamelOption.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); if (capitalization.CapitalSnakeOption.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); if (capitalization.SCAETHFlowPointsOption.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); if (capitalization.SmallCamelOption.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + writer.WriteString("smallCamel", capitalization.SmallCamel); if (capitalization.SmallSnakeOption.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 307f19f4682d..3dce21bf6471 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -48,13 +48,13 @@ public Cat(string className, Option declawed = default, Option co /// Used to track the state of Declawed /// [JsonIgnore] - public Option DeclawedOption { get; private set; } // option d + public Option DeclawedOption { get; private set; } /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } // d + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new(value); } } /// /// Returns the string presentation of the object @@ -140,7 +140,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value, declawed, color); // a + return new Cat(className.Value, declawed, color); } /// @@ -173,13 +173,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.ColorOption.IsSet && cat.Color == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); // 1 + writer.WriteString("className", cat.ClassName); if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); // 2 + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); if (cat.ColorOption.IsSet) - writer.WriteString("color", cat.Color); // 1 + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index e95584756da5..c6dfc5f5cd39 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -48,19 +48,19 @@ public Category(string name = @"default-name", Option id = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Gets or Sets additional properties @@ -156,7 +156,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value, id); // a + return new Category(name.Value, id); } /// @@ -186,10 +186,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); // 1 + writer.WriteString("name", category.Name); if (category.IdOption.IsSet) - writer.WriteNumber("id", category.IdOption.Value.Value); // 3 + writer.WriteNumber("id", category.IdOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 100ad6956008..97ac270d0da8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -100,25 +100,25 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] - public new Option PetTypeOption { get; private set; } // option a + public new Option PetTypeOption { get; private set; } /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } // a + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Returns the string presentation of the object @@ -196,7 +196,7 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType); // a + return new ChildCat(name, petType); } /// @@ -227,9 +227,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); if (childCat.NameOption.IsSet) - writer.WriteString("name", childCat.Name); // 1 + writer.WriteString("name", childCat.Name); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); // 7 + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index 8213ddd10f02..98773d0f2550 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -46,13 +46,13 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (varClass.IsSet && varClass.Value == null) throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); // a + return new ClassModel(varClass); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClassOption.IsSet) - writer.WriteString("_class", classModel.VarClass); // 1 + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 2ba439964da6..747b36ec65bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -48,13 +48,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); // a + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs index 2310e9adb29f..c28634e4e13e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -46,7 +46,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - return new DanishPig(className.Value); // a + return new DanishPig(className.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); // 1 + writer.WriteString("className", danishPig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 2950805954ff..4a83b416b2f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -46,14 +46,14 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] - public Option DateOnlyPropertyOption { get; private set; } // option d + public Option DateOnlyPropertyOption { get; private set; } /// /// Gets or Sets DateOnlyProperty /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } // d + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -143,7 +143,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty); // a + return new DateOnlyClass(dateOnlyProperty); } /// @@ -171,7 +171,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyPropertyOption.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); // 4 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 3eaa0bc2895f..07281cc492a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -46,13 +46,13 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); // a + return new DeprecatedObject(name); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.NameOption.IsSet) - writer.WriteString("name", deprecatedObject.Name); // 1 + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index 4bf73f9f8b23..b9020ff75ecc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -48,13 +48,13 @@ public Dog(string className, Option breed = default, Option colo /// Used to track the state of Breed /// [JsonIgnore] - public Option BreedOption { get; private set; } // option d + public Option BreedOption { get; private set; } /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } // d + public string Breed { get { return this. BreedOption; } set { this.BreedOption = new(value); } } /// /// Returns the string presentation of the object @@ -139,7 +139,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(className.Value, breed, color); // a + return new Dog(className.Value, breed, color); } /// @@ -175,13 +175,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.ColorOption.IsSet && dog.Color == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); // 1 + writer.WriteString("className", dog.ClassName); if (dog.BreedOption.IsSet) - writer.WriteString("breed", dog.Breed); // 1 + writer.WriteString("breed", dog.Breed); if (dog.ColorOption.IsSet) - writer.WriteString("color", dog.Color); // 1 + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index c8db08ac71de..7063c123aa98 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -52,49 +52,49 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of MainShape /// [JsonIgnore] - public Option MainShapeOption { get; private set; } // option d + public Option MainShapeOption { get; private set; } /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } // d + public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } /// /// Used to track the state of Shapes /// [JsonIgnore] - public Option> ShapesOption { get; private set; } // option d + public Option> ShapesOption { get; private set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } // d + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } /// /// Used to track the state of NullableShape /// [JsonIgnore] - public Option NullableShapeOption { get; private set; } // option d + public Option NullableShapeOption { get; private set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } // d + public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new(value); } } /// /// Used to track the state of ShapeOrNull /// [JsonIgnore] - public Option ShapeOrNullOption { get; private set; } // option d + public Option ShapeOrNullOption { get; private set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } // d + public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } /// /// Gets or Sets additional properties @@ -211,7 +211,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -244,13 +244,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri if (drawing.ShapesOption.IsSet && drawing.Shapes == null) throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - if (drawing.MainShapeOption.IsSet) // 14 + if (drawing.MainShapeOption.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.ShapesOption.IsSet) // 14 + if (drawing.ShapesOption.IsSet) writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { writer.WritePropertyName("nullableShape"); @@ -258,7 +258,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.IsSet) if (drawing.ShapeOrNullOption.Value != null) { writer.WritePropertyName("shapeOrNull"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 46723a8556a4..779559982ba4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -180,25 +180,25 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] - public Option JustSymbolOption { get; private set; } // option a + public Option JustSymbolOption { get; private set; } /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } // a + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new(value); } } /// /// Used to track the state of ArrayEnum /// [JsonIgnore] - public Option> ArrayEnumOption { get; private set; } // option d + public Option> ArrayEnumOption { get; private set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } // d + public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -293,7 +293,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justSymbol.IsSet && justSymbol.Value == null) throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol); // a + return new EnumArrays(arrayEnum, justSymbol); } /// @@ -323,10 +323,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - if (enumArrays.ArrayEnumOption.IsSet) // 14 + if (enumArrays.ArrayEnumOption.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); // 7 + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 8d739b80f265..8863bc0cc6ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -212,7 +212,7 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets EnumStringRequired /// [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Defines EnumInteger @@ -277,13 +277,13 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] - public Option EnumIntegerOption { get; private set; } // option a + public Option EnumIntegerOption { get; private set; } /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } // a + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new(value); } } /// /// Defines EnumIntegerOnly @@ -348,13 +348,13 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] - public Option EnumIntegerOnlyOption { get; private set; } // option a + public Option EnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } // a + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new(value); } } /// /// Defines EnumNumber @@ -426,13 +426,13 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] - public Option EnumNumberOption { get; private set; } // option a + public Option EnumNumberOption { get; private set; } /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } // a + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new(value); } } /// /// Defines EnumString @@ -588,61 +588,61 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] - public Option EnumStringOption { get; private set; } // option a + public Option EnumStringOption { get; private set; } /// /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } // a + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } /// /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] - public Option OuterEnumDefaultValueOption { get; private set; } // option a + public Option OuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnumInteger /// [JsonIgnore] - public Option OuterEnumIntegerOption { get; private set; } // option a + public Option OuterEnumIntegerOption { get; private set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } // a + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new(value); } } /// /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] - public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a + public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } // a + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } /// /// Used to track the state of OuterEnum /// [JsonIgnore] - public Option OuterEnumOption { get; private set; } // option a + public Option OuterEnumOption { get; private set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } // a + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -805,7 +805,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); } /// @@ -832,46 +832,46 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); if (enumTest.EnumIntegerOption.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); if (enumTest.EnumIntegerOnlyOption.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); if (enumTest.EnumNumberOption.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); // 6 + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); // 7 + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else writer.WriteNull("enum_string"); - if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumDefaultValueOption.IsSet) { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); // 10 b + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); } - if (enumTest.OuterEnumIntegerOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerOption.IsSet) { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); // 10 b + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } - if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); // 10 b + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) // 10 - if (enumTest.OuterEnumOption.Value != null) // 10 a + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); // 10 c + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); } else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 7e719d26f712..bbf4bf8f8e09 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -48,13 +48,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType.Value, triangleType.Value); // a + return new EquilateralTriangle(shapeType.Value, triangleType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index 9cf97af03ad1..f935a8c9a920 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -46,14 +46,14 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] - public Option SourceURIOption { get; private set; } // option d + public Option SourceURIOption { get; private set; } /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } // d + public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (sourceURI.IsSet && sourceURI.Value == null) throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); // a + return new File(sourceURI); } /// @@ -168,7 +168,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURIOption.IsSet) - writer.WriteString("sourceURI", file.SourceURI); // 1 + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index d4c7047588e9..a83672dc1d63 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -48,25 +48,25 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of File /// [JsonIgnore] - public Option FileOption { get; private set; } // option d + public Option FileOption { get; private set; } /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get { return this. FileOption; } set { this.FileOption = new(value); } } // d + public File File { get { return this. FileOption; } set { this.FileOption = new(value); } } /// /// Used to track the state of Files /// [JsonIgnore] - public Option> FilesOption { get; private set; } // option d + public Option> FilesOption { get; private set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } // d + public List Files { get { return this. FilesOption; } set { this.FilesOption = new(value); } } /// /// Gets or Sets additional properties @@ -160,7 +160,7 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type if (files.IsSet && files.Value == null) throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); // a + return new FileSchemaTestClass(file, files); } /// @@ -193,10 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - if (fileSchemaTestClass.FileOption.IsSet) // 14 + if (fileSchemaTestClass.FileOption.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.FilesOption.IsSet) // 14 + if (fileSchemaTestClass.FilesOption.IsSet) writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index 365155901cf8..ca6b4f74b0bf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -46,13 +46,13 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; private set; } // option d + public Option BarOption { get; private set; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } // d + public string Bar { get { return this. BarOption; } set { this.BarOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (bar.IsSet && bar.Value == null) throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); // a + return new Foo(bar); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.BarOption.IsSet) - writer.WriteString("bar", foo.Bar); // 1 + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 709e634e9165..df5273b29e40 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -46,13 +46,13 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); // a + return new FooGetDefaultResponse(varString); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + if (fooGetDefaultResponse.VarStringOption.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 8fa75d4c161d..543b540f7860 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -82,211 +82,211 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } // d + public byte[] VarByte { get; set; } /// /// Gets or Sets Date /// /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } // d + public DateTime Date { get; set; } /// /// Gets or Sets Number /// [JsonPropertyName("number")] - public decimal Number { get; set; } // d + public decimal Number { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } // d + public string Password { get; set; } /// /// Used to track the state of Binary /// [JsonIgnore] - public Option BinaryOption { get; private set; } // option d + public Option BinaryOption { get; private set; } /// /// Gets or Sets Binary /// [JsonPropertyName("binary")] - public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } // d + public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new(value); } } /// /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of VarDecimal /// [JsonIgnore] - public Option VarDecimalOption { get; private set; } // option d + public Option VarDecimalOption { get; private set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } // d + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new(value); } } /// /// Used to track the state of VarDouble /// [JsonIgnore] - public Option VarDoubleOption { get; private set; } // option d + public Option VarDoubleOption { get; private set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } // d + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new(value); } } /// /// Used to track the state of VarFloat /// [JsonIgnore] - public Option VarFloatOption { get; private set; } // option d + public Option VarFloatOption { get; private set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } // d + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new(value); } } /// /// Used to track the state of Int32 /// [JsonIgnore] - public Option Int32Option { get; private set; } // option d + public Option Int32Option { get; private set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } // d + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new(value); } } /// /// Used to track the state of Int64 /// [JsonIgnore] - public Option Int64Option { get; private set; } // option d + public Option Int64Option { get; private set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } // d + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new(value); } } /// /// Used to track the state of Integer /// [JsonIgnore] - public Option IntegerOption { get; private set; } // option d + public Option IntegerOption { get; private set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } // d + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new(value); } } /// /// Used to track the state of PatternWithBackslash /// [JsonIgnore] - public Option PatternWithBackslashOption { get; private set; } // option d + public Option PatternWithBackslashOption { get; private set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } // d + public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new(value); } } /// /// Used to track the state of PatternWithDigits /// [JsonIgnore] - public Option PatternWithDigitsOption { get; private set; } // option d + public Option PatternWithDigitsOption { get; private set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } // d + public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new(value); } } /// /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] - public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d + public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } // d + public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new(value); } } /// /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } // d + public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new(value); } } /// /// Used to track the state of UnsignedInteger /// [JsonIgnore] - public Option UnsignedIntegerOption { get; private set; } // option d + public Option UnsignedIntegerOption { get; private set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } // d + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new(value); } } /// /// Used to track the state of UnsignedLong /// [JsonIgnore] - public Option UnsignedLongOption { get; private set; } // option d + public Option UnsignedLongOption { get; private set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } // d + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -674,7 +674,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); } /// @@ -723,57 +723,57 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); // 3 + writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); // 1 + writer.WriteString("password", formatTest.Password); - if (formatTest.BinaryOption.IsSet) // 14 + if (formatTest.BinaryOption.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTimeOption.IsSet) - writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimalOption.IsSet) // 14 + if (formatTest.VarDecimalOption.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDoubleOption.IsSet) - writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); // 3 + writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); if (formatTest.VarFloatOption.IsSet) - writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); // 3 + writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); if (formatTest.Int32Option.IsSet) - writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); // 3 + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); if (formatTest.Int64Option.IsSet) - writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); // 3 + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); if (formatTest.IntegerOption.IsSet) - writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); // 3 + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); if (formatTest.PatternWithBackslashOption.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); if (formatTest.PatternWithDigitsOption.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); if (formatTest.VarStringOption.IsSet) - writer.WriteString("string", formatTest.VarString); // 1 + writer.WriteString("string", formatTest.VarString); if (formatTest.UnsignedIntegerOption.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); // 3 + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); if (formatTest.UnsignedLongOption.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); // 3 + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); if (formatTest.UuidOption.IsSet) - writer.WriteString("uuid", formatTest.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index 75d815fe69da..56babaeafe4b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -69,13 +69,13 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -175,10 +175,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); // b + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, color); // b + return new Fruit(banana, color); throw new JsonException(); } @@ -211,7 +211,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs index 7fd5e012fc5e..75652a1b436e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -150,10 +150,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); // b + return new FruitReq(appleReq); if (bananaReq != null) - return new FruitReq(bananaReq); // b + return new FruitReq(bananaReq); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index d97438ec1919..75b6c0bb7af2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -49,35 +49,35 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] - public Option AppleOption { get; private set; } // option b + public Option AppleOption { get; private set; } /// /// Gets or Sets Apple /// - public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } /// /// Used to track the state of Banana /// [JsonIgnore] - public Option BananaOption { get; private set; } // option b + public Option BananaOption { get; private set; } /// /// Gets or Sets Banana /// - public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Returns the string presentation of the object @@ -183,7 +183,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve ? default : new Option(banana); - return new GmFruit(appleParsedValue, bananaParsedValue, color); // a + return new GmFruit(appleParsedValue, bananaParsedValue, color); } /// @@ -226,7 +226,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.ColorOption.IsSet) - writer.WriteString("color", gmFruit.Color); // 1 + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 104b1e543cd8..6b7d7ae8da68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -46,7 +46,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } // d + public string PetType { get; set; } /// /// Gets or Sets additional properties @@ -143,7 +143,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - return new GrandparentAnimal(petType.Value); // a + return new GrandparentAnimal(petType.Value); } /// @@ -173,7 +173,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 + writer.WriteString("pet_type", grandparentAnimal.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index ba871e18b903..ea29e35293ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -48,25 +48,25 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } } // d + public string Bar { get { return this. BarOption; } } /// /// Used to track the state of Foo /// [JsonIgnore] - public Option FooOption { get; } // option d + public Option FooOption { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get { return this. FooOption; } } // d + public string Foo { get { return this. FooOption; } } /// /// Gets or Sets additional properties @@ -199,7 +199,7 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ if (foo.IsSet && foo.Value == null) throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); // a + return new HasOnlyReadOnly(bar, foo); } /// @@ -233,10 +233,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); if (hasOnlyReadOnly.BarOption.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + writer.WriteString("bar", hasOnlyReadOnly.Bar); if (hasOnlyReadOnly.FooOption.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 4c8d158466c5..1d0eac7201d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -46,13 +46,13 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] - public Option NullableMessageOption { get; private set; } // option d + public Option NullableMessageOption { get; private set; } /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } // d + public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new(value); } } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); // a + return new HealthCheckResult(nullableMessage); } /// @@ -162,7 +162,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessageOption.IsSet) if (healthCheckResult.NullableMessageOption.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f28b3dceafe5..3f4aa3229c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -48,13 +48,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Returns the string presentation of the object @@ -145,7 +145,7 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType.Value, triangleType.Value); // a + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); } /// @@ -178,9 +178,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index 45ab2d2f47e9..e8d6aacdebba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -46,13 +46,13 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] - public Option Var123ListOption { get; private set; } // option d + public Option Var123ListOption { get; private set; } /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } // d + public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123List.IsSet && var123List.Value == null) throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); // a + return new List(var123List); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123ListOption.IsSet) - writer.WriteString("123-list", list.Var123List); // 1 + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 0832d03a155a..c6e49ac7068f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -48,25 +48,25 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of EscapedLiteralString /// [JsonIgnore] - public Option EscapedLiteralStringOption { get; private set; } // option d + public Option EscapedLiteralStringOption { get; private set; } /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } // d + public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new(value); } } /// /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] - public Option UnescapedLiteralStringOption { get; private set; } // option d + public Option UnescapedLiteralStringOption { get; private set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } // d + public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -158,7 +158,7 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -192,10 +192,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); if (literalStringClass.EscapedLiteralStringOption.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); if (literalStringClass.UnescapedLiteralStringOption.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs index 14518765c768..1ea0d944f050 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -86,7 +86,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -223,13 +223,13 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className.Value); // c + return new Mammal(pig, className.Value); if (whale != null) - return new Mammal(whale, className.Value); // c + return new Mammal(whale, className.Value); if (zebra != null) - return new Mammal(zebra, className.Value); // c + return new Mammal(zebra, className.Value); throw new JsonException(); } @@ -276,7 +276,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); // 1 + writer.WriteString("className", mammal.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index b3f67421f044..2c4fbfaa7650 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -118,49 +118,49 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of DirectMap /// [JsonIgnore] - public Option> DirectMapOption { get; private set; } // option d + public Option> DirectMapOption { get; private set; } /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } // d + public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new(value); } } /// /// Used to track the state of IndirectMap /// [JsonIgnore] - public Option> IndirectMapOption { get; private set; } // option d + public Option> IndirectMapOption { get; private set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } // d + public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new(value); } } /// /// Used to track the state of MapMapOfString /// [JsonIgnore] - public Option>> MapMapOfStringOption { get; private set; } // option d + public Option>> MapMapOfStringOption { get; private set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } // d + public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new(value); } } /// /// Used to track the state of MapOfEnumString /// [JsonIgnore] - public Option> MapOfEnumStringOption { get; private set; } // option d + public Option> MapOfEnumStringOption { get; private set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } // d + public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -272,7 +272,7 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -311,16 +311,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - if (mapTest.DirectMapOption.IsSet) // 14 + if (mapTest.DirectMapOption.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMapOption.IsSet) // 14 + if (mapTest.IndirectMapOption.IsSet) writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfStringOption.IsSet) // 14 + if (mapTest.MapMapOfStringOption.IsSet) writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumStringOption.IsSet) // 14 + if (mapTest.MapOfEnumStringOption.IsSet) writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 7ebb1eaa01e3..d71a2c249bcb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -52,49 +52,49 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new(value); } } /// /// Used to track the state of Map /// [JsonIgnore] - public Option> MapOption { get; private set; } // option d + public Option> MapOption { get; private set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new(value); } } // d + public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Used to track the state of UuidWithPattern /// [JsonIgnore] - public Option UuidWithPatternOption { get; private set; } // option d + public Option UuidWithPatternOption { get; private set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } // d + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new(value); } } /// /// Gets or Sets additional properties @@ -218,7 +218,7 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); } /// @@ -249,16 +249,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); // 11 + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index 53aa7ea41a27..db34a8e96bf4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -48,25 +48,25 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } // d + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public int? Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name); // a + return new Model200Response(varClass, name); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); if (model200Response.VarClassOption.IsSet) - writer.WriteString("class", model200Response.VarClass); // 1 + writer.WriteString("class", model200Response.VarClass); if (model200Response.NameOption.IsSet) - writer.WriteNumber("name", model200Response.NameOption.Value.Value); // 3 + writer.WriteNumber("name", model200Response.NameOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index db0925940805..b656dcc7dd76 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -46,13 +46,13 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] - public Option VarClientOption { get; private set; } // option d + public Option VarClientOption { get; private set; } /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } // d + public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (varClient.IsSet && varClient.Value == null) throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); // a + return new ModelClient(varClient); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClientOption.IsSet) - writer.WriteString("client", modelClient.VarClient); // 1 + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index 9543525c067d..97cf771d1141 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -52,43 +52,43 @@ public Name(int varName, Option property = default, Option snakeCa /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } // d + public int VarName { get; set; } /// /// Used to track the state of Property /// [JsonIgnore] - public Option PropertyOption { get; private set; } // option d + public Option PropertyOption { get; private set; } /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } // d + public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new(value); } } /// /// Used to track the state of SnakeCase /// [JsonIgnore] - public Option SnakeCaseOption { get; } // option d + public Option SnakeCaseOption { get; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + public int? SnakeCase { get { return this. SnakeCaseOption; } } /// /// Used to track the state of Var123Number /// [JsonIgnore] - public Option Var123NumberOption { get; } // option d + public Option Var123NumberOption { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int? Var123Number { get { return this. Var123NumberOption; } } // d + public int? Var123Number { get { return this. Var123NumberOption; } } /// /// Gets or Sets additional properties @@ -243,7 +243,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123Number.IsSet && var123Number.Value == null) throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value.Value, property, snakeCase, var123Number); // a + return new Name(varName.Value.Value, property, snakeCase, var123Number); } /// @@ -273,16 +273,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.PropertyOption.IsSet && name.Property == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); // 3 + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) - writer.WriteString("property", name.Property); // 1 + writer.WriteString("property", name.Property); if (name.SnakeCaseOption.IsSet) - writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); // 3 + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); if (name.Var123NumberOption.IsSet) - writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); // 3 + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index e91111bfa6af..cd1516104e35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -48,13 +48,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } // d + public List> AObjVariableobject { get; set; } /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } // d + public int PkiNotificationtestID { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); // a + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); } /// @@ -185,8 +185,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElemen throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 28daf2558be5..4780e3a4093e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -68,145 +68,145 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] - public Option> ArrayItemsNullableOption { get; private set; } // option d + public Option> ArrayItemsNullableOption { get; private set; } /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } // d + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] - public Option> ObjectItemsNullableOption { get; private set; } // option d + public Option> ObjectItemsNullableOption { get; private set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } // d + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] - public Option> ArrayAndItemsNullablePropOption { get; private set; } // option d + public Option> ArrayAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } // d + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ArrayNullableProp /// [JsonIgnore] - public Option> ArrayNullablePropOption { get; private set; } // option d + public Option> ArrayNullablePropOption { get; private set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } // d + public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new(value); } } /// /// Used to track the state of BooleanProp /// [JsonIgnore] - public Option BooleanPropOption { get; private set; } // option d + public Option BooleanPropOption { get; private set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } // d + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new(value); } } /// /// Used to track the state of DateProp /// [JsonIgnore] - public Option DatePropOption { get; private set; } // option d + public Option DatePropOption { get; private set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } // d + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new(value); } } /// /// Used to track the state of DatetimeProp /// [JsonIgnore] - public Option DatetimePropOption { get; private set; } // option d + public Option DatetimePropOption { get; private set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } // d + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new(value); } } /// /// Used to track the state of IntegerProp /// [JsonIgnore] - public Option IntegerPropOption { get; private set; } // option d + public Option IntegerPropOption { get; private set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } // d + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new(value); } } /// /// Used to track the state of NumberProp /// [JsonIgnore] - public Option NumberPropOption { get; private set; } // option d + public Option NumberPropOption { get; private set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } // d + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new(value); } } /// /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] - public Option> ObjectAndItemsNullablePropOption { get; private set; } // option d + public Option> ObjectAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } // d + public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } /// /// Used to track the state of ObjectNullableProp /// [JsonIgnore] - public Option> ObjectNullablePropOption { get; private set; } // option d + public Option> ObjectNullablePropOption { get; private set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } // d + public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new(value); } } /// /// Used to track the state of StringProp /// [JsonIgnore] - public Option StringPropOption { get; private set; } // option d + public Option StringPropOption { get; private set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } // d + public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new(value); } } /// /// Gets or Sets additional properties @@ -380,7 +380,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -413,13 +413,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + if (nullableClass.ArrayItemsNullableOption.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + if (nullableClass.ObjectItemsNullableOption.IsSet) writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("array_and_items_nullable_prop"); @@ -427,7 +427,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { writer.WritePropertyName("array_nullable_prop"); @@ -437,35 +437,35 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("array_nullable_prop"); if (nullableClass.BooleanPropOption.IsSet) if (nullableClass.BooleanPropOption.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); else writer.WriteNull("boolean_prop"); if (nullableClass.DatePropOption.IsSet) if (nullableClass.DatePropOption.Value != null) - writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); // 4 + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); else writer.WriteNull("date_prop"); if (nullableClass.DatetimePropOption.IsSet) if (nullableClass.DatetimePropOption.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); // 5 + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerPropOption.IsSet) if (nullableClass.IntegerPropOption.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); // 3 + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); else writer.WriteNull("integer_prop"); if (nullableClass.NumberPropOption.IsSet) if (nullableClass.NumberPropOption.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); // 3 + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); else writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -473,7 +473,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { writer.WritePropertyName("object_nullable_prop"); @@ -483,7 +483,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("object_nullable_prop"); if (nullableClass.StringPropOption.IsSet) if (nullableClass.StringPropOption.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp); // 1 + writer.WriteString("string_prop", nullableClass.StringProp); else writer.WriteNull("string_prop"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 8bcf65599477..e0a01b485848 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -46,14 +46,14 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); // a + return new NullableGuidClass(uuid); } /// @@ -164,7 +164,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.UuidOption.IsSet) if (nullableGuidClass.UuidOption.Value != null) - writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs index de01979e880b..1e38640c8af9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -69,7 +69,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType.Value); // c + return new NullableShape(quadrilateral, shapeType.Value); if (triangle != null) - return new NullableShape(triangle, shapeType.Value); // c + return new NullableShape(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); // 1 + writer.WriteString("shapeType", nullableShape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 110600467404..86945bd858d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -46,13 +46,13 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] - public Option JustNumberOption { get; private set; } // option d + public Option JustNumberOption { get; private set; } /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } // d + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justNumber.IsSet && justNumber.Value == null) throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber); // a + return new NumberOnly(justNumber); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { if (numberOnly.JustNumberOption.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); // 3 + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index f70cb11eb40b..be79d8d45d3f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -52,52 +52,52 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] - public Option> BarsOption { get; private set; } // option d + public Option> BarsOption { get; private set; } /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } // d + public List Bars { get { return this. BarsOption; } set { this.BarsOption = new(value); } } /// /// Used to track the state of DeprecatedRef /// [JsonIgnore] - public Option DeprecatedRefOption { get; private set; } // option d + public Option DeprecatedRefOption { get; private set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } // d + public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } // d + public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -208,7 +208,7 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); } /// @@ -244,17 +244,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + if (objectWithDeprecatedFields.BarsOption.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.IdOption.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); // 3 + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); if (objectWithDeprecatedFields.UuidOption.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs index 99d1c17f0843..660604e3ef17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -122,10 +122,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index a214e51ab8bd..c53b3b870d53 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -137,75 +137,75 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of PetId /// [JsonIgnore] - public Option PetIdOption { get; private set; } // option d + public Option PetIdOption { get; private set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } // d + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new(value); } } /// /// Used to track the state of Quantity /// [JsonIgnore] - public Option QuantityOption { get; private set; } // option d + public Option QuantityOption { get; private set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } // d + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new(value); } } /// /// Used to track the state of ShipDate /// [JsonIgnore] - public Option ShipDateOption { get; private set; } // option d + public Option ShipDateOption { get; private set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } // d + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } /// /// Used to track the state of Complete /// [JsonIgnore] - public Option CompleteOption { get; private set; } // option d + public Option CompleteOption { get; private set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } // d + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } /// /// Gets or Sets additional properties @@ -341,7 +341,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (complete.IsSet && complete.Value == null) throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id, petId, quantity, shipDate, status, complete); // a + return new Order(id, petId, quantity, shipDate, status, complete); } /// @@ -369,25 +369,25 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { if (order.IdOption.IsSet) - writer.WriteNumber("id", order.IdOption.Value.Value); // 3 + writer.WriteNumber("id", order.IdOption.Value.Value); if (order.PetIdOption.IsSet) - writer.WriteNumber("petId", order.PetIdOption.Value.Value); // 3 + writer.WriteNumber("petId", order.PetIdOption.Value.Value); if (order.QuantityOption.IsSet) - writer.WriteNumber("quantity", order.QuantityOption.Value.Value); // 3 + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); if (order.ShipDateOption.IsSet) - writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); // 5 + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); // 7 + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value.Value); // 2 + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index b8767f3b50fe..87f0cdad335a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -50,37 +50,37 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] - public Option MyBooleanOption { get; private set; } // option d + public Option MyBooleanOption { get; private set; } /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } // d + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new(value); } } /// /// Used to track the state of MyNumber /// [JsonIgnore] - public Option MyNumberOption { get; private set; } // option d + public Option MyNumberOption { get; private set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } // d + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new(value); } } /// /// Used to track the state of MyString /// [JsonIgnore] - public Option MyStringOption { get; private set; } // option d + public Option MyStringOption { get; private set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } // d + public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new(value); } } /// /// Gets or Sets additional properties @@ -182,7 +182,7 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type if (myString.IsSet && myString.Value == null) throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean, myNumber, myString); // a + return new OuterComposite(myBoolean, myNumber, myString); } /// @@ -213,13 +213,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); if (outerComposite.MyBooleanOption.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); // 2 + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); if (outerComposite.MyNumberOption.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); // 3 + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); if (outerComposite.MyStringOption.IsSet) - writer.WriteString("my_string", outerComposite.MyString); // 1 + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs index 9c292f10c059..c451e1a8991b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -109,7 +109,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - return new ParentPet(petType.Value); // a + return new ParentPet(petType.Value); } /// @@ -139,7 +139,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); // 1 + writer.WriteString("pet_type", parentPet.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 9733663c31e8..464c517b575e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -137,63 +137,63 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } /// /// Gets or Sets Name /// /// doggie [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Gets or Sets PhotoUrls /// [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } // d + public List PhotoUrls { get; set; } /// /// Used to track the state of Category /// [JsonIgnore] - public Option CategoryOption { get; private set; } // option d + public Option CategoryOption { get; private set; } /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } // d + public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Tags /// [JsonIgnore] - public Option> TagsOption { get; private set; } // option d + public Option> TagsOption { get; private set; } /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } // d + public List Tags { get { return this. TagsOption; } set { this.TagsOption = new(value); } } /// /// Gets or Sets additional properties @@ -329,7 +329,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (tags.IsSet && tags.Value == null) throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(name.Value, photoUrls.Value, category, id, status, tags); // a + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); } /// @@ -368,23 +368,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.TagsOption.IsSet && pet.Tags == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); // 1 + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 - if (pet.CategoryOption.IsSet) // 14 + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); if (pet.IdOption.IsSet) - writer.WriteNumber("id", pet.IdOption.Value.Value); // 3 + writer.WriteNumber("id", pet.IdOption.Value.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); // 7 + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.TagsOption.IsSet) // 14 + if (pet.TagsOption.IsSet) writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs index f1eb3e0e3145..d3bbeb8ff326 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pig.cs @@ -69,7 +69,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className.Value); // c + return new Pig(basquePig, className.Value); if (danishPig != null) - return new Pig(danishPig, className.Value); // c + return new Pig(danishPig, className.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); // 1 + writer.WriteString("className", pig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 78791de532b9..2c2227a22512 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -195,16 +195,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); // b + return new PolymorphicProperty(varBool); if (varString != null) - return new PolymorphicProperty(varString); // b + return new PolymorphicProperty(varString); if (varObject != null) - return new PolymorphicProperty(varObject); // b + return new PolymorphicProperty(varObject); if (list != null) - return new PolymorphicProperty(list); // b + return new PolymorphicProperty(list); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 2c238cd4ce3a..3f4034a17713 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -69,7 +69,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); // c + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); // c + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 69c52bc4bafc..75b7e516cfca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -46,7 +46,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T if (quadrilateralType.IsSet && quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType.Value); // a + return new QuadrilateralInterface(quadrilateralType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 450798bad130..4880e135b807 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -48,25 +48,25 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } } // d + public string Bar { get { return this. BarOption; } } /// /// Used to track the state of Baz /// [JsonIgnore] - public Option BazOption { get; private set; } // option d + public Option BazOption { get; private set; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } // d + public string Baz { get { return this. BazOption; } set { this.BazOption = new(value); } } /// /// Gets or Sets additional properties @@ -196,7 +196,7 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (baz.IsSet && baz.Value == null) throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); // a + return new ReadOnlyFirst(bar, baz); } /// @@ -230,10 +230,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); if (readOnlyFirst.BarOption.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar); // 1 + writer.WriteString("bar", readOnlyFirst.Bar); if (readOnlyFirst.BazOption.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz); // 1 + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 66f9dacd78d8..7a0ee42e5336 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -191,7 +191,7 @@ public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnulla /// Gets or Sets RequiredNotnullableEnumInteger /// [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } /// /// Defines RequiredNotnullableEnumIntegerOnly @@ -256,7 +256,7 @@ public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotn /// Gets or Sets RequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNotnullableEnumString @@ -412,13 +412,13 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul /// Gets or Sets RequiredNotnullableEnumString /// [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } /// /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNotnullableEnumInteger @@ -483,13 +483,13 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumInteger /// [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumIntegerOnly @@ -554,13 +554,13 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNotnullableEnumString @@ -716,25 +716,25 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumString /// [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } // a + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines RequiredNullableEnumInteger @@ -799,7 +799,7 @@ public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnu /// Gets or Sets RequiredNullableEnumInteger /// [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// /// Defines RequiredNullableEnumIntegerOnly @@ -864,7 +864,7 @@ public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullabl /// Gets or Sets RequiredNullableEnumIntegerOnly /// [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNullableEnumString @@ -1023,13 +1023,13 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE /// Gets or Sets RequiredNullableEnumString /// [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNullableEnumInteger @@ -1094,13 +1094,13 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumInteger /// [JsonPropertyName("notrequired_nullable_enum_integer")] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } // a + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new(value); } } /// /// Defines NotrequiredNullableEnumIntegerOnly @@ -1165,13 +1165,13 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumIntegerOnly /// [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } // a + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new(value); } } /// /// Defines NotrequiredNullableEnumString @@ -1330,281 +1330,281 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] - public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumString /// [JsonPropertyName("notrequired_nullable_enum_string")] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } // a + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } // a + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new(value); } } /// /// Gets or Sets RequiredNotNullableDateProp /// [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } // d + public DateTime RequiredNotNullableDateProp { get; set; } /// /// Gets or Sets RequiredNotnullableArrayOfString /// [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } // d + public List RequiredNotnullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNotnullableBooleanProp /// [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } // d + public bool RequiredNotnullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNotnullableDatetimeProp /// [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + public DateTime RequiredNotnullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNotnullableStringProp /// [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } // d + public string RequiredNotnullableStringProp { get; set; } /// /// Gets or Sets RequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } // d + public Guid RequiredNotnullableUuid { get; set; } /// /// Gets or Sets RequiredNotnullableintegerProp /// [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } // d + public int RequiredNotnullableintegerProp { get; set; } /// /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] - public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableDateProp /// [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableintegerProp /// [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } // d + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] - public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableArrayOfString /// [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } // d + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableBooleanProp /// [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableDatetimeProp /// [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] - public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableStringProp /// [JsonPropertyName("notrequired_notnullable_string_prop")] - public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } // d + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] - public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + public Option NotrequiredNotnullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } // d + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Gets or Sets RequiredNullableArrayOfString /// [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } // d + public List RequiredNullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNullableBooleanProp /// [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } // d + public bool? RequiredNullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNullableDateProp /// [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } // d + public DateTime? RequiredNullableDateProp { get; set; } /// /// Gets or Sets RequiredNullableDatetimeProp /// [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } // d + public DateTime? RequiredNullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNullableIntegerProp /// [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } // d + public int? RequiredNullableIntegerProp { get; set; } /// /// Gets or Sets RequiredNullableStringProp /// [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } // d + public string RequiredNullableStringProp { get; set; } /// /// Gets or Sets RequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } // d + public Guid? RequiredNullableUuid { get; set; } /// /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] - public Option NotRequiredNullableDatePropOption { get; private set; } // option d + public Option NotRequiredNullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableDateProp /// [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } // d + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] - public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableIntegerProp /// [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } // d + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] - public Option> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableArrayOfString /// [JsonPropertyName("notrequired_nullable_array_of_string")] - public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } // d + public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new(value); } } /// /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableBooleanProp /// [JsonPropertyName("notrequired_nullable_boolean_prop")] - public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } // d + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableDatetimeProp /// [JsonPropertyName("notrequired_nullable_datetime_prop")] - public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } // d + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] - public Option NotrequiredNullableStringPropOption { get; private set; } // option d + public Option NotrequiredNullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableStringProp /// [JsonPropertyName("notrequired_nullable_string_prop")] - public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } // d + public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new(value); } } /// /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] - public Option NotrequiredNullableUuidOption { get; private set; } // option d + public Option NotrequiredNullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_nullable_uuid")] - public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } // d + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -2120,7 +2120,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2159,72 +2159,72 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else writer.WriteNull("required_notnullable_enum_string"); - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); // 3 + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); // 7 + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else writer.WriteNull("notrequired_notnullable_enum_string"); - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); // 10 b + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); // 11 + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); - if (requiredClass.RequiredNullableArrayOfString != null) // 12 + if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2232,46 +2232,46 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_array_of_string"); if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); else writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); else writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); else writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); else writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); else writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); // 7 + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); else writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); else @@ -2279,28 +2279,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); // 3 + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); else writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2310,51 +2310,51 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_array_of_string"); if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); else writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); else writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); // 7 + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) // 10 a + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); // 10 c + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); if (requiredClass.NotrequiredNullableStringPropOption.IsSet) if (requiredClass.NotrequiredNullableStringPropOption.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); else writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuidOption.IsSet) if (requiredClass.NotrequiredNullableUuidOption.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); // 11 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index 2c0b12129a68..f1f9f795f99a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -46,13 +46,13 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] - public Option VarReturnOption { get; private set; } // option d + public Option VarReturnOption { get; private set; } /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } // d + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (varReturn.IsSet && varReturn.Value == null) throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn); // a + return new Return(varReturn); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { if (varReturn.VarReturnOption.IsSet) - writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); // 3 + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 99a366447d5f..5cfcd6ecc998 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -48,25 +48,25 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] - public Option RoleOption { get; private set; } // option d + public Option RoleOption { get; private set; } /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } // d + public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new(value); } } /// /// Used to track the state of RoleUuid /// [JsonIgnore] - public Option RoleUuidOption { get; private set; } // option d + public Option RoleUuidOption { get; private set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } // d + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new(value); } } /// /// Gets or Sets additional properties @@ -160,7 +160,7 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty if (roleUuid.IsSet && roleUuid.Value == null) throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid); // a + return new RolesReportsHash(role, roleUuid); } /// @@ -190,11 +190,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - if (rolesReportsHash.RoleOption.IsSet) // 14 + if (rolesReportsHash.RoleOption.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuidOption.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); // 11 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index abaec09fac9f..b89398c84518 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -46,13 +46,13 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); // a + return new RolesReportsHashRole(name); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.NameOption.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name); // 1 + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 7f53a5055a5b..52a8e0d69c60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -48,13 +48,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType.Value, triangleType.Value); // a + return new ScaleneTriangle(shapeType.Value, triangleType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs index 0f3e3ae6ee76..575069f242e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Shape.cs @@ -69,7 +69,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType.Value); // c + return new Shape(quadrilateral, shapeType.Value); if (triangle != null) - return new Shape(triangle, shapeType.Value); // c + return new Shape(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); // 1 + writer.WriteString("shapeType", shape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 9e7193f38251..5bd364cc6a41 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -46,7 +46,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - return new ShapeInterface(shapeType.Value); // a + return new ShapeInterface(shapeType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 + writer.WriteString("shapeType", shapeInterface.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 3fdfa16615cf..a26dab034230 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -69,7 +69,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType.Value); // c + return new ShapeOrNull(quadrilateral, shapeType.Value); if (triangle != null) - return new ShapeOrNull(triangle, shapeType.Value); // c + return new ShapeOrNull(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 0edbb338199b..a00a87e2efa5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -48,13 +48,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); // a + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 3ef8f5e2c981..41c18257a9dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -48,25 +48,25 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] - public Option VarSpecialModelNameOption { get; private set; } // option d + public Option VarSpecialModelNameOption { get; private set; } /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } // d + public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new(value); } } /// /// Used to track the state of SpecialPropertyName /// [JsonIgnore] - public Option SpecialPropertyNameOption { get; private set; } // option d + public Option SpecialPropertyNameOption { get; private set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } // d + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty if (specialPropertyName.IsSet && specialPropertyName.Value == null) throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName); // a + return new SpecialModelName(varSpecialModelName, specialPropertyName); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); if (specialModelName.VarSpecialModelNameOption.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); if (specialModelName.SpecialPropertyNameOption.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); // 3 + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index e637b595099f..dd7cba60a978 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -48,25 +48,25 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id, name); // a + return new Tag(id, name); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); if (tag.IdOption.IsSet) - writer.WriteNumber("id", tag.IdOption.Value.Value); // 3 + writer.WriteNumber("id", tag.IdOption.Value.Value); if (tag.NameOption.IsSet) - writer.WriteString("name", tag.Name); // 1 + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 02c45f70d155..fc98c8364bef 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -46,13 +46,13 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] - public Option ValueOption { get; private set; } // option d + public Option ValueOption { get; private set; } /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } // d + public string Value { get { return this. ValueOption; } set { this.ValueOption = new(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso if (value.IsSet && value.Value == null) throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); // a + return new TestCollectionEndingWithWordList(value); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.ValueOption.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 223580adaab0..ab5e7ee33849 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -46,13 +46,13 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] - public Option> TestCollectionEndingWithWordListOption { get; private set; } // option d + public Option> TestCollectionEndingWithWordListOption { get; private set; } /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } // d + public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index eb5429eca152..abee3c8e1bee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -46,13 +46,13 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Used to track the state of SomeProperty /// [JsonIgnore] - public Option SomePropertyOption { get; private set; } // option d + public Option SomePropertyOption { get; private set; } /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } // d + public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new(value); } } /// /// Gets or Sets additional properties @@ -147,7 +147,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR if (someProperty.IsSet && someProperty.Value == null) throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -178,7 +178,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs index ca5cf704e909..737124e080b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -86,7 +86,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -223,13 +223,13 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType.Value); // c + return new Triangle(equilateralTriangle, triangleType.Value); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType.Value); // c + return new Triangle(isoscelesTriangle, triangleType.Value); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType.Value); // c + return new Triangle(scaleneTriangle, triangleType.Value); throw new JsonException(); } @@ -276,7 +276,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); // 1 + writer.WriteString("triangleType", triangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index f21bcd8522f6..270c598de618 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -46,7 +46,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - return new TriangleInterface(triangleType.Value); // a + return new TriangleInterface(triangleType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 + writer.WriteString("triangleType", triangleInterface.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index d4916fd06dd6..e7c66ae29a42 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -68,150 +68,150 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Email /// [JsonIgnore] - public Option EmailOption { get; private set; } // option d + public Option EmailOption { get; private set; } /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } // d + public string Email { get { return this. EmailOption; } set { this.EmailOption = new(value); } } /// /// Used to track the state of FirstName /// [JsonIgnore] - public Option FirstNameOption { get; private set; } // option d + public Option FirstNameOption { get; private set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } /// /// Used to track the state of LastName /// [JsonIgnore] - public Option LastNameOption { get; private set; } // option d + public Option LastNameOption { get; private set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } // d + public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } /// /// Used to track the state of Password /// [JsonIgnore] - public Option PasswordOption { get; private set; } // option d + public Option PasswordOption { get; private set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } // d + public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new(value); } } /// /// Used to track the state of Phone /// [JsonIgnore] - public Option PhoneOption { get; private set; } // option d + public Option PhoneOption { get; private set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } // d + public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new(value); } } /// /// Used to track the state of UserStatus /// [JsonIgnore] - public Option UserStatusOption { get; private set; } // option d + public Option UserStatusOption { get; private set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } // d + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new(value); } } /// /// Used to track the state of Username /// [JsonIgnore] - public Option UsernameOption { get; private set; } // option d + public Option UsernameOption { get; private set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } // d + public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } /// /// Used to track the state of AnyTypeProp /// [JsonIgnore] - public Option AnyTypePropOption { get; private set; } // option d + public Option AnyTypePropOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } // d + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } /// /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] - public Option AnyTypePropNullableOption { get; private set; } // option d + public Option AnyTypePropNullableOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } // d + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } /// /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } // d + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } /// /// Gets or Sets additional properties @@ -380,7 +380,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -429,33 +429,33 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); if (user.EmailOption.IsSet) - writer.WriteString("email", user.Email); // 1 + writer.WriteString("email", user.Email); if (user.FirstNameOption.IsSet) - writer.WriteString("firstName", user.FirstName); // 1 + writer.WriteString("firstName", user.FirstName); if (user.IdOption.IsSet) - writer.WriteNumber("id", user.IdOption.Value.Value); // 3 + writer.WriteNumber("id", user.IdOption.Value.Value); if (user.LastNameOption.IsSet) - writer.WriteString("lastName", user.LastName); // 1 + writer.WriteString("lastName", user.LastName); - if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsOption.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.PasswordOption.IsSet) - writer.WriteString("password", user.Password); // 1 + writer.WriteString("password", user.Password); if (user.PhoneOption.IsSet) - writer.WriteString("phone", user.Phone); // 1 + writer.WriteString("phone", user.Phone); if (user.UserStatusOption.IsSet) - writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); // 3 + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); if (user.UsernameOption.IsSet) - writer.WriteString("username", user.Username); // 1 + writer.WriteString("username", user.Username); - if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) { writer.WritePropertyName("anyTypeProp"); @@ -463,7 +463,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.IsSet) if (user.AnyTypePropNullableOption.Value != null) { writer.WritePropertyName("anyTypePropNullable"); @@ -471,7 +471,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) { writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index eb7088c40948..5592ec84cd82 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -50,31 +50,31 @@ public Whale(string className, Option hasBaleen = default, Option /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of HasBaleen /// [JsonIgnore] - public Option HasBaleenOption { get; private set; } // option d + public Option HasBaleenOption { get; private set; } /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } // d + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new(value); } } /// /// Used to track the state of HasTeeth /// [JsonIgnore] - public Option HasTeethOption { get; private set; } // option d + public Option HasTeethOption { get; private set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } // d + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new(value); } } /// /// Gets or Sets additional properties @@ -179,7 +179,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (hasTeeth.IsSet && hasTeeth.Value == null) throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className.Value, hasBaleen, hasTeeth); // a + return new Whale(className.Value, hasBaleen, hasTeeth); } /// @@ -209,13 +209,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); // 1 + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); // 2 + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); if (whale.HasTeethOption.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); // 2 + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index bf8b978f048a..1af781019d59 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -128,19 +128,19 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option a + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } // a + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -248,7 +248,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className.Value, type); // a + return new Zebra(className.Value, type); } /// @@ -278,9 +278,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); // 1 + writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); // 7 + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index dda9c5f3d9a2..3efd4c639fb5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -112,13 +112,13 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] - public Option ZeroBasedEnumOption { get; private set; } // option a + public Option ZeroBasedEnumOption { get; private set; } /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } // a + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new(value); } } /// /// Gets or Sets additional properties @@ -204,7 +204,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum); // a + return new ZeroBasedEnumClass(zeroBasedEnum); } /// @@ -231,7 +231,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); // 7 + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index 5c246bae8ecb..67b118519c6c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -51,13 +51,13 @@ public Adult(Option?> children = default, Option firstName /// Used to track the state of Children /// [JsonIgnore] - public Option?> ChildrenOption { get; private set; } // option d + public Option?> ChildrenOption { get; private set; } /// /// Gets or Sets Children /// [JsonPropertyName("children")] - public List? Children { get { return this. ChildrenOption; } set { this.ChildrenOption = new(value); } } // d + public List? Children { get { return this. ChildrenOption; } set { this.ChildrenOption = new(value); } } /// /// Returns the string presentation of the object @@ -147,7 +147,7 @@ public override Adult Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Adult."); - return new Adult(children, firstName, lastName, type); // a + return new Adult(children, firstName, lastName, type); } /// @@ -186,17 +186,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializ if (adult.TypeOption.IsSet && adult.Type == null) throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult."); - if (adult.ChildrenOption.IsSet) // 14 + if (adult.ChildrenOption.IsSet) writer.WritePropertyName("children"); JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); if (adult.FirstNameOption.IsSet) - writer.WriteString("firstName", adult.FirstName); // 1 + writer.WriteString("firstName", adult.FirstName); if (adult.LastNameOption.IsSet) - writer.WriteString("lastName", adult.LastName); // 1 + writer.WriteString("lastName", adult.LastName); if (adult.TypeOption.IsSet) - writer.WriteString("$_type", adult.Type); // 1 + writer.WriteString("$_type", adult.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index a8b4c3f6fc24..70431b4b0c88 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -53,25 +53,25 @@ public Child(Option age = default, Option firstName = default, Op /// Used to track the state of Age /// [JsonIgnore] - public Option AgeOption { get; private set; } // option d + public Option AgeOption { get; private set; } /// /// Gets or Sets Age /// [JsonPropertyName("age")] - public int? Age { get { return this. AgeOption; } set { this.AgeOption = new(value); } } // d + public int? Age { get { return this. AgeOption; } set { this.AgeOption = new(value); } } /// /// Used to track the state of BoosterSeat /// [JsonIgnore] - public Option BoosterSeatOption { get; private set; } // option d + public Option BoosterSeatOption { get; private set; } /// /// Gets or Sets BoosterSeat /// [JsonPropertyName("boosterSeat")] - public bool? BoosterSeat { get { return this. BoosterSeatOption; } set { this.BoosterSeatOption = new(value); } } // d + public bool? BoosterSeat { get { return this. BoosterSeatOption; } set { this.BoosterSeatOption = new(value); } } /// /// Returns the string presentation of the object @@ -170,7 +170,7 @@ public override Child Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (boosterSeat.IsSet && boosterSeat.Value == null) throw new ArgumentNullException(nameof(boosterSeat), "Property is not nullable for class Child."); - return new Child(age, firstName, lastName, type, boosterSeat); // a + return new Child(age, firstName, lastName, type, boosterSeat); } /// @@ -207,19 +207,19 @@ public void WriteProperties(ref Utf8JsonWriter writer, Child child, JsonSerializ throw new ArgumentNullException(nameof(child.Type), "Property is required for class Child."); if (child.AgeOption.IsSet) - writer.WriteNumber("age", child.AgeOption.Value!.Value); // 3 + writer.WriteNumber("age", child.AgeOption.Value!.Value); if (child.FirstNameOption.IsSet) - writer.WriteString("firstName", child.FirstName); // 1 + writer.WriteString("firstName", child.FirstName); if (child.LastNameOption.IsSet) - writer.WriteString("lastName", child.LastName); // 1 + writer.WriteString("lastName", child.LastName); if (child.TypeOption.IsSet) - writer.WriteString("$_type", child.Type); // 1 + writer.WriteString("$_type", child.Type); if (child.BoosterSeatOption.IsSet) - writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value); // 2 + writer.WriteBoolean("boosterSeat", child.BoosterSeatOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index 41ce78a860b6..a47fc8de7704 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -52,37 +52,37 @@ public Person(Option firstName = default, Option lastName = de /// Used to track the state of FirstName /// [JsonIgnore] - public Option FirstNameOption { get; private set; } // option d + public Option FirstNameOption { get; private set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } // d + public string? FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new(value); } } /// /// Used to track the state of LastName /// [JsonIgnore] - public Option LastNameOption { get; private set; } // option d + public Option LastNameOption { get; private set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } // d + public string? LastName { get { return this. LastNameOption; } set { this.LastNameOption = new(value); } } /// /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option d + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("$_type")] - public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } // d + public string? Type { get { return this. TypeOption; } set { this.TypeOption = new(value); } } /// /// Gets or Sets additional properties @@ -192,7 +192,7 @@ public override Person Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Person."); - return new Person(firstName, lastName, type); // a + return new Person(firstName, lastName, type); } /// @@ -229,13 +229,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Person person, JsonSerial throw new ArgumentNullException(nameof(person.Type), "Property is required for class Person."); if (person.FirstNameOption.IsSet) - writer.WriteString("firstName", person.FirstName); // 1 + writer.WriteString("firstName", person.FirstName); if (person.LastNameOption.IsSet) - writer.WriteString("lastName", person.LastName); // 1 + writer.WriteString("lastName", person.LastName); if (person.TypeOption.IsSet) - writer.WriteString("$_type", person.Type); // 1 + writer.WriteString("$_type", person.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index a1badbbd472a..b9ffd13416a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -48,13 +48,13 @@ public Apple(Option kind = default) /// Used to track the state of Kind /// [JsonIgnore] - public Option KindOption { get; private set; } // option d + public Option KindOption { get; private set; } /// /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } // d + public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (kind.IsSet && kind.Value == null) throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); // a + return new Apple(kind); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); if (apple.KindOption.IsSet) - writer.WriteString("kind", apple.Kind); // 1 + writer.WriteString("kind", apple.Kind); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs index bb3fcdc28fda..583e86cb7bf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -48,13 +48,13 @@ public Banana(Option count = default) /// Used to track the state of Count /// [JsonIgnore] - public Option CountOption { get; private set; } // option d + public Option CountOption { get; private set; } /// /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } // d + public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (count.IsSet && count.Value == null) throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count); // a + return new Banana(count); } /// @@ -167,7 +167,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.CountOption.IsSet) - writer.WriteNumber("count", banana.CountOption.Value!.Value); // 3 + writer.WriteNumber("count", banana.CountOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index 3095dd9ba870..0e913217083c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -51,35 +51,35 @@ public Fruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] - public Option AppleOption { get; private set; } // option b + public Option AppleOption { get; private set; } /// /// Gets or Sets Apple /// - public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } // b + public Apple? Apple { get { return this.AppleOption; } set { this.AppleOption = new(value); } } /// /// Used to track the state of Banana /// [JsonIgnore] - public Option BananaOption { get; private set; } // option b + public Option BananaOption { get; private set; } /// /// Gets or Sets Banana /// - public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } // b + public Banana? Banana { get { return this.BananaOption; } set { this.BananaOption = new(value); } } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Gets or Sets additional properties @@ -192,7 +192,7 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert ? default : new Option(banana); - return new Fruit(appleParsedValue, bananaParsedValue, color); // a + return new Fruit(appleParsedValue, bananaParsedValue, color); } /// @@ -235,7 +235,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index a1badbbd472a..b9ffd13416a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -48,13 +48,13 @@ public Apple(Option kind = default) /// Used to track the state of Kind /// [JsonIgnore] - public Option KindOption { get; private set; } // option d + public Option KindOption { get; private set; } /// /// Gets or Sets Kind /// [JsonPropertyName("kind")] - public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } // d + public string? Kind { get { return this. KindOption; } set { this.KindOption = new(value); } } /// /// Gets or Sets additional properties @@ -138,7 +138,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (kind.IsSet && kind.Value == null) throw new ArgumentNullException(nameof(kind), "Property is not nullable for class Apple."); - return new Apple(kind); // a + return new Apple(kind); } /// @@ -169,7 +169,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Kind), "Property is required for class Apple."); if (apple.KindOption.IsSet) - writer.WriteString("kind", apple.Kind); // 1 + writer.WriteString("kind", apple.Kind); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs index bb3fcdc28fda..583e86cb7bf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -48,13 +48,13 @@ public Banana(Option count = default) /// Used to track the state of Count /// [JsonIgnore] - public Option CountOption { get; private set; } // option d + public Option CountOption { get; private set; } /// /// Gets or Sets Count /// [JsonPropertyName("count")] - public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } // d + public decimal? Count { get { return this. CountOption; } set { this.CountOption = new(value); } } /// /// Gets or Sets additional properties @@ -139,7 +139,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (count.IsSet && count.Value == null) throw new ArgumentNullException(nameof(count), "Property is not nullable for class Banana."); - return new Banana(count); // a + return new Banana(count); } /// @@ -167,7 +167,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.CountOption.IsSet) - writer.WriteNumber("count", banana.CountOption.Value!.Value); // 3 + writer.WriteNumber("count", banana.CountOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index 4c3b1f4893a1..03ece3cda5af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -71,13 +71,13 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } // d + public string? Color { get { return this. ColorOption; } set { this.ColorOption = new(value); } } /// /// Gets or Sets additional properties @@ -184,10 +184,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); // b + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, color); // b + return new Fruit(banana, color); throw new JsonException(); } @@ -220,7 +220,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 2f454803efc6..2967b0cfe7d2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -46,13 +46,13 @@ public Activity(Option [JsonIgnore] - public Option>> ActivityOutputsOption { get; private set; } // option d + public Option>> ActivityOutputsOption { get; private set; } /// /// Gets or Sets ActivityOutputs /// [JsonPropertyName("activity_outputs")] - public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new Option>>(value); } } // d + public Dictionary> ActivityOutputs { get { return this. ActivityOutputsOption; } set { this.ActivityOutputsOption = new Option>>(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Activity Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (activityOutputs.IsSet && activityOutputs.Value == null) throw new ArgumentNullException(nameof(activityOutputs), "Property is not nullable for class Activity."); - return new Activity(activityOutputs); // a + return new Activity(activityOutputs); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe if (activity.ActivityOutputsOption.IsSet && activity.ActivityOutputs == null) throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); - if (activity.ActivityOutputsOption.IsSet) // 14 + if (activity.ActivityOutputsOption.IsSet) writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 0825c1699f7a..e4819e39a5bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -48,25 +48,25 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop1 /// [JsonIgnore] - public Option Prop1Option { get; private set; } // option d + public Option Prop1Option { get; private set; } /// /// Gets or Sets Prop1 /// [JsonPropertyName("prop1")] - public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new Option(value); } } // d + public string Prop1 { get { return this. Prop1Option; } set { this.Prop1Option = new Option(value); } } /// /// Used to track the state of Prop2 /// [JsonIgnore] - public Option Prop2Option { get; private set; } // option d + public Option Prop2Option { get; private set; } /// /// Gets or Sets Prop2 /// [JsonPropertyName("prop2")] - public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new Option(value); } } // d + public Object Prop2 { get { return this. Prop2Option; } set { this.Prop2Option = new Option(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override ActivityOutputElementRepresentation Read(ref Utf8JsonReader utf8 if (prop2.IsSet && prop2.Value == null) throw new ArgumentNullException(nameof(prop2), "Property is not nullable for class ActivityOutputElementRepresentation."); - return new ActivityOutputElementRepresentation(prop1, prop2); // a + return new ActivityOutputElementRepresentation(prop1, prop2); } /// @@ -193,9 +193,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr throw new ArgumentNullException(nameof(activityOutputElementRepresentation.Prop2), "Property is required for class ActivityOutputElementRepresentation."); if (activityOutputElementRepresentation.Prop1Option.IsSet) - writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); // 1 + writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); - if (activityOutputElementRepresentation.Prop2Option.IsSet) // 14 + if (activityOutputElementRepresentation.Prop2Option.IsSet) writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 8f164acbc1fa..0fa0ed15c912 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -60,98 +60,98 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] - public Option EmptyMapOption { get; private set; } // option d + public Option EmptyMapOption { get; private set; } /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// /// an object with no declared properties and no undeclared properties, hence it's an empty map. [JsonPropertyName("empty_map")] - public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new Option(value); } } // d + public Object EmptyMap { get { return this. EmptyMapOption; } set { this.EmptyMapOption = new Option(value); } } /// /// Used to track the state of MapOfMapProperty /// [JsonIgnore] - public Option>> MapOfMapPropertyOption { get; private set; } // option d + public Option>> MapOfMapPropertyOption { get; private set; } /// /// Gets or Sets MapOfMapProperty /// [JsonPropertyName("map_of_map_property")] - public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new Option>>(value); } } // d + public Dictionary> MapOfMapProperty { get { return this. MapOfMapPropertyOption; } set { this.MapOfMapPropertyOption = new Option>>(value); } } /// /// Used to track the state of MapProperty /// [JsonIgnore] - public Option> MapPropertyOption { get; private set; } // option d + public Option> MapPropertyOption { get; private set; } /// /// Gets or Sets MapProperty /// [JsonPropertyName("map_property")] - public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new Option>(value); } } // d + public Dictionary MapProperty { get { return this. MapPropertyOption; } set { this.MapPropertyOption = new Option>(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype1 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype1 /// [JsonPropertyName("map_with_undeclared_properties_anytype_1")] - public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new Option(value); } } // d + public Object MapWithUndeclaredPropertiesAnytype1 { get { return this. MapWithUndeclaredPropertiesAnytype1Option; } set { this.MapWithUndeclaredPropertiesAnytype1Option = new Option(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype2 /// [JsonIgnore] - public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } // option d + public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype2 /// [JsonPropertyName("map_with_undeclared_properties_anytype_2")] - public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new Option(value); } } // d + public Object MapWithUndeclaredPropertiesAnytype2 { get { return this. MapWithUndeclaredPropertiesAnytype2Option; } set { this.MapWithUndeclaredPropertiesAnytype2Option = new Option(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesAnytype3 /// [JsonIgnore] - public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } // option d + public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesAnytype3 /// [JsonPropertyName("map_with_undeclared_properties_anytype_3")] - public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new Option>(value); } } // d + public Dictionary MapWithUndeclaredPropertiesAnytype3 { get { return this. MapWithUndeclaredPropertiesAnytype3Option; } set { this.MapWithUndeclaredPropertiesAnytype3Option = new Option>(value); } } /// /// Used to track the state of MapWithUndeclaredPropertiesString /// [JsonIgnore] - public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } // option d + public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } /// /// Gets or Sets MapWithUndeclaredPropertiesString /// [JsonPropertyName("map_with_undeclared_properties_string")] - public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new Option>(value); } } // d + public Dictionary MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new Option>(value); } } /// /// Used to track the state of Anytype1 /// [JsonIgnore] - public Option Anytype1Option { get; private set; } // option d + public Option Anytype1Option { get; private set; } /// /// Gets or Sets Anytype1 /// [JsonPropertyName("anytype_1")] - public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new Option(value); } } // d + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new Option(value); } } /// /// Gets or Sets additional properties @@ -296,7 +296,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); // a + return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); } /// @@ -344,28 +344,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); - if (additionalPropertiesClass.EmptyMapOption.IsSet) // 14 + if (additionalPropertiesClass.EmptyMapOption.IsSet) writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); - if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapPropertyOption.IsSet) // 14 + if (additionalPropertiesClass.MapPropertyOption.IsSet) writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); - if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) // 14 + if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); - if (additionalPropertiesClass.Anytype1Option.IsSet) // 14 + if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { writer.WritePropertyName("anytype_1"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index f17ad63bb343..921afe647f07 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -48,19 +48,19 @@ public Animal(string className, Option color = default) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -165,7 +165,7 @@ public override Animal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Animal."); - return new Animal(className.Value, color); // a + return new Animal(className.Value, color); } /// @@ -198,10 +198,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Animal animal, JsonSerial if (animal.ColorOption.IsSet && animal.Color == null) throw new ArgumentNullException(nameof(animal.Color), "Property is required for class Animal."); - writer.WriteString("className", animal.ClassName); // 1 + writer.WriteString("className", animal.ClassName); if (animal.ColorOption.IsSet) - writer.WriteString("color", animal.Color); // 1 + writer.WriteString("color", animal.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index ebdc8b4fc4ae..74fa2260d40f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -50,37 +50,37 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Code /// [JsonIgnore] - public Option CodeOption { get; private set; } // option d + public Option CodeOption { get; private set; } /// /// Gets or Sets Code /// [JsonPropertyName("code")] - public int? Code { get { return this. CodeOption; } set { this.CodeOption = new Option(value); } } // d + public int? Code { get { return this. CodeOption; } set { this.CodeOption = new Option(value); } } /// /// Used to track the state of Message /// [JsonIgnore] - public Option MessageOption { get; private set; } // option d + public Option MessageOption { get; private set; } /// /// Gets or Sets Message /// [JsonPropertyName("message")] - public string Message { get { return this. MessageOption; } set { this.MessageOption = new Option(value); } } // d + public string Message { get { return this. MessageOption; } set { this.MessageOption = new Option(value); } } /// /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option d + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public string Type { get { return this. TypeOption; } set { this.TypeOption = new Option(value); } } // d + public string Type { get { return this. TypeOption; } set { this.TypeOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -181,7 +181,7 @@ public override ApiResponse Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class ApiResponse."); - return new ApiResponse(code, message, type); // a + return new ApiResponse(code, message, type); } /// @@ -215,13 +215,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ApiResponse apiResponse, throw new ArgumentNullException(nameof(apiResponse.Type), "Property is required for class ApiResponse."); if (apiResponse.CodeOption.IsSet) - writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); // 3 + writer.WriteNumber("code", apiResponse.CodeOption.Value.Value); if (apiResponse.MessageOption.IsSet) - writer.WriteString("message", apiResponse.Message); // 1 + writer.WriteString("message", apiResponse.Message); if (apiResponse.TypeOption.IsSet) - writer.WriteString("type", apiResponse.Type); // 1 + writer.WriteString("type", apiResponse.Type); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index 5d56ab65fcd2..a6c311a3742c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -50,37 +50,37 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of ColorCode /// [JsonIgnore] - public Option ColorCodeOption { get; private set; } // option d + public Option ColorCodeOption { get; private set; } /// /// Gets or Sets ColorCode /// [JsonPropertyName("color_code")] - public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new Option(value); } } // d + public string ColorCode { get { return this. ColorCodeOption; } set { this.ColorCodeOption = new Option(value); } } /// /// Used to track the state of Cultivar /// [JsonIgnore] - public Option CultivarOption { get; private set; } // option d + public Option CultivarOption { get; private set; } /// /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new Option(value); } } // d + public string Cultivar { get { return this. CultivarOption; } set { this.CultivarOption = new Option(value); } } /// /// Used to track the state of Origin /// [JsonIgnore] - public Option OriginOption { get; private set; } // option d + public Option OriginOption { get; private set; } /// /// Gets or Sets Origin /// [JsonPropertyName("origin")] - public string Origin { get { return this. OriginOption; } set { this.OriginOption = new Option(value); } } // d + public string Origin { get { return this. OriginOption; } set { this.OriginOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -210,7 +210,7 @@ public override Apple Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (origin.IsSet && origin.Value == null) throw new ArgumentNullException(nameof(origin), "Property is not nullable for class Apple."); - return new Apple(colorCode, cultivar, origin); // a + return new Apple(colorCode, cultivar, origin); } /// @@ -247,13 +247,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Apple apple, JsonSerializ throw new ArgumentNullException(nameof(apple.Origin), "Property is required for class Apple."); if (apple.ColorCodeOption.IsSet) - writer.WriteString("color_code", apple.ColorCode); // 1 + writer.WriteString("color_code", apple.ColorCode); if (apple.CultivarOption.IsSet) - writer.WriteString("cultivar", apple.Cultivar); // 1 + writer.WriteString("cultivar", apple.Cultivar); if (apple.OriginOption.IsSet) - writer.WriteString("origin", apple.Origin); // 1 + writer.WriteString("origin", apple.Origin); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index b2f893aa320d..b7818ca9aa56 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -48,19 +48,19 @@ public AppleReq(string cultivar, Option mealy = default) /// Gets or Sets Cultivar /// [JsonPropertyName("cultivar")] - public string Cultivar { get; set; } // d + public string Cultivar { get; set; } /// /// Used to track the state of Mealy /// [JsonIgnore] - public Option MealyOption { get; private set; } // option d + public Option MealyOption { get; private set; } /// /// Gets or Sets Mealy /// [JsonPropertyName("mealy")] - public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new Option(value); } } // d + public bool? Mealy { get { return this. MealyOption; } set { this.MealyOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -149,7 +149,7 @@ public override AppleReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (mealy.IsSet && mealy.Value == null) throw new ArgumentNullException(nameof(mealy), "Property is not nullable for class AppleReq."); - return new AppleReq(cultivar.Value, mealy); // a + return new AppleReq(cultivar.Value, mealy); } /// @@ -179,10 +179,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, AppleReq appleReq, JsonSe if (appleReq.Cultivar == null) throw new ArgumentNullException(nameof(appleReq.Cultivar), "Property is required for class AppleReq."); - writer.WriteString("cultivar", appleReq.Cultivar); // 1 + writer.WriteString("cultivar", appleReq.Cultivar); if (appleReq.MealyOption.IsSet) - writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); // 2 + writer.WriteBoolean("mealy", appleReq.MealyOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index a5171f72300f..22f1f89b1fe4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -46,13 +46,13 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] - public Option>> ArrayArrayNumberOption { get; private set; } // option d + public Option>> ArrayArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayArrayNumber /// [JsonPropertyName("ArrayArrayNumber")] - public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new Option>>(value); } } // d + public List> ArrayArrayNumber { get { return this. ArrayArrayNumberOption; } set { this.ArrayArrayNumberOption = new Option>>(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override ArrayOfArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, if (arrayArrayNumber.IsSet && arrayArrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayArrayNumber), "Property is not nullable for class ArrayOfArrayOfNumberOnly."); - return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); // a + return new ArrayOfArrayOfNumberOnly(arrayArrayNumber); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet && arrayOfArrayOfNumberOnly.ArrayArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); - if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) // 14 + if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index c9ca0a5026d2..be73ffe15930 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -46,13 +46,13 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] - public Option> ArrayNumberOption { get; private set; } // option d + public Option> ArrayNumberOption { get; private set; } /// /// Gets or Sets ArrayNumber /// [JsonPropertyName("ArrayNumber")] - public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new Option>(value); } } // d + public List ArrayNumber { get { return this. ArrayNumberOption; } set { this.ArrayNumberOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override ArrayOfNumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type t if (arrayNumber.IsSet && arrayNumber.Value == null) throw new ArgumentNullException(nameof(arrayNumber), "Property is not nullable for class ArrayOfNumberOnly."); - return new ArrayOfNumberOnly(arrayNumber); // a + return new ArrayOfNumberOnly(arrayNumber); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf if (arrayOfNumberOnly.ArrayNumberOption.IsSet && arrayOfNumberOnly.ArrayNumber == null) throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); - if (arrayOfNumberOnly.ArrayNumberOption.IsSet) // 14 + if (arrayOfNumberOnly.ArrayNumberOption.IsSet) writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 6590004582a9..1d983789c4dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -50,37 +50,37 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] - public Option>> ArrayArrayOfIntegerOption { get; private set; } // option d + public Option>> ArrayArrayOfIntegerOption { get; private set; } /// /// Gets or Sets ArrayArrayOfInteger /// [JsonPropertyName("array_array_of_integer")] - public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new Option>>(value); } } // d + public List> ArrayArrayOfInteger { get { return this. ArrayArrayOfIntegerOption; } set { this.ArrayArrayOfIntegerOption = new Option>>(value); } } /// /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] - public Option>> ArrayArrayOfModelOption { get; private set; } // option d + public Option>> ArrayArrayOfModelOption { get; private set; } /// /// Gets or Sets ArrayArrayOfModel /// [JsonPropertyName("array_array_of_model")] - public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new Option>>(value); } } // d + public List> ArrayArrayOfModel { get { return this. ArrayArrayOfModelOption; } set { this.ArrayArrayOfModelOption = new Option>>(value); } } /// /// Used to track the state of ArrayOfString /// [JsonIgnore] - public Option> ArrayOfStringOption { get; private set; } // option d + public Option> ArrayOfStringOption { get; private set; } /// /// Gets or Sets ArrayOfString /// [JsonPropertyName("array_of_string")] - public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new Option>(value); } } // d + public List ArrayOfString { get { return this. ArrayOfStringOption; } set { this.ArrayOfStringOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -183,7 +183,7 @@ public override ArrayTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (arrayOfString.IsSet && arrayOfString.Value == null) throw new ArgumentNullException(nameof(arrayOfString), "Property is not nullable for class ArrayTest."); - return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); // a + return new ArrayTest(arrayArrayOfInteger, arrayArrayOfModel, arrayOfString); } /// @@ -219,13 +219,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json if (arrayTest.ArrayOfStringOption.IsSet && arrayTest.ArrayOfString == null) throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); - if (arrayTest.ArrayArrayOfIntegerOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfIntegerOption.IsSet) writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); - if (arrayTest.ArrayArrayOfModelOption.IsSet) // 14 + if (arrayTest.ArrayArrayOfModelOption.IsSet) writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); - if (arrayTest.ArrayOfStringOption.IsSet) // 14 + if (arrayTest.ArrayOfStringOption.IsSet) writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs index 8f7a0b09b831..cd4bee166bed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs @@ -46,13 +46,13 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] - public Option LengthCmOption { get; private set; } // option d + public Option LengthCmOption { get; private set; } /// /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new Option(value); } } // d + public decimal? LengthCm { get { return this. LengthCmOption; } set { this.LengthCmOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Banana Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (lengthCm.IsSet && lengthCm.Value == null) throw new ArgumentNullException(nameof(lengthCm), "Property is not nullable for class Banana."); - return new Banana(lengthCm); // a + return new Banana(lengthCm); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Banana banana, JsonSerializerO public void WriteProperties(ref Utf8JsonWriter writer, Banana banana, JsonSerializerOptions jsonSerializerOptions) { if (banana.LengthCmOption.IsSet) - writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); // 3 + writer.WriteNumber("lengthCm", banana.LengthCmOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index db117e6c6dbc..a8ede7f6f250 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -48,19 +48,19 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Gets or Sets LengthCm /// [JsonPropertyName("lengthCm")] - public decimal LengthCm { get; set; } // d + public decimal LengthCm { get; set; } /// /// Used to track the state of Sweet /// [JsonIgnore] - public Option SweetOption { get; private set; } // option d + public Option SweetOption { get; private set; } /// /// Gets or Sets Sweet /// [JsonPropertyName("sweet")] - public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new Option(value); } } // d + public bool? Sweet { get { return this. SweetOption; } set { this.SweetOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -150,7 +150,7 @@ public override BananaReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (sweet.IsSet && sweet.Value == null) throw new ArgumentNullException(nameof(sweet), "Property is not nullable for class BananaReq."); - return new BananaReq(lengthCm.Value.Value, sweet); // a + return new BananaReq(lengthCm.Value.Value, sweet); } /// @@ -177,10 +177,10 @@ public override void Write(Utf8JsonWriter writer, BananaReq bananaReq, JsonSeria /// public void WriteProperties(ref Utf8JsonWriter writer, BananaReq bananaReq, JsonSerializerOptions jsonSerializerOptions) { - writer.WriteNumber("lengthCm", bananaReq.LengthCm); // 3 + writer.WriteNumber("lengthCm", bananaReq.LengthCm); if (bananaReq.SweetOption.IsSet) - writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); // 2 + writer.WriteBoolean("sweet", bananaReq.SweetOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs index 3c2aaf08e492..53c20a25cd10 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BasquePig.cs @@ -46,7 +46,7 @@ public BasquePig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override BasquePig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class BasquePig."); - return new BasquePig(className.Value); // a + return new BasquePig(className.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, BasquePig basquePig, Json if (basquePig.ClassName == null) throw new ArgumentNullException(nameof(basquePig.ClassName), "Property is required for class BasquePig."); - writer.WriteString("className", basquePig.ClassName); // 1 + writer.WriteString("className", basquePig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index 6ccc5da39b24..0808395011fa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -56,74 +56,74 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of ATT_NAME /// [JsonIgnore] - public Option ATT_NAMEOption { get; private set; } // option d + public Option ATT_NAMEOption { get; private set; } /// /// Name of the pet /// /// Name of the pet [JsonPropertyName("ATT_NAME")] - public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new Option(value); } } // d + public string ATT_NAME { get { return this. ATT_NAMEOption; } set { this.ATT_NAMEOption = new Option(value); } } /// /// Used to track the state of CapitalCamel /// [JsonIgnore] - public Option CapitalCamelOption { get; private set; } // option d + public Option CapitalCamelOption { get; private set; } /// /// Gets or Sets CapitalCamel /// [JsonPropertyName("CapitalCamel")] - public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new Option(value); } } // d + public string CapitalCamel { get { return this. CapitalCamelOption; } set { this.CapitalCamelOption = new Option(value); } } /// /// Used to track the state of CapitalSnake /// [JsonIgnore] - public Option CapitalSnakeOption { get; private set; } // option d + public Option CapitalSnakeOption { get; private set; } /// /// Gets or Sets CapitalSnake /// [JsonPropertyName("Capital_Snake")] - public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new Option(value); } } // d + public string CapitalSnake { get { return this. CapitalSnakeOption; } set { this.CapitalSnakeOption = new Option(value); } } /// /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] - public Option SCAETHFlowPointsOption { get; private set; } // option d + public Option SCAETHFlowPointsOption { get; private set; } /// /// Gets or Sets SCAETHFlowPoints /// [JsonPropertyName("SCA_ETH_Flow_Points")] - public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new Option(value); } } // d + public string SCAETHFlowPoints { get { return this. SCAETHFlowPointsOption; } set { this.SCAETHFlowPointsOption = new Option(value); } } /// /// Used to track the state of SmallCamel /// [JsonIgnore] - public Option SmallCamelOption { get; private set; } // option d + public Option SmallCamelOption { get; private set; } /// /// Gets or Sets SmallCamel /// [JsonPropertyName("smallCamel")] - public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new Option(value); } } // d + public string SmallCamel { get { return this. SmallCamelOption; } set { this.SmallCamelOption = new Option(value); } } /// /// Used to track the state of SmallSnake /// [JsonIgnore] - public Option SmallSnakeOption { get; private set; } // option d + public Option SmallSnakeOption { get; private set; } /// /// Gets or Sets SmallSnake /// [JsonPropertyName("small_Snake")] - public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new Option(value); } } // d + public string SmallSnake { get { return this. SmallSnakeOption; } set { this.SmallSnakeOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -247,7 +247,7 @@ public override Capitalization Read(ref Utf8JsonReader utf8JsonReader, Type type if (smallSnake.IsSet && smallSnake.Value == null) throw new ArgumentNullException(nameof(smallSnake), "Property is not nullable for class Capitalization."); - return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); // a + return new Capitalization(aTTNAME, capitalCamel, capitalSnake, sCAETHFlowPoints, smallCamel, smallSnake); } /// @@ -293,22 +293,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, Capitalization capitaliza throw new ArgumentNullException(nameof(capitalization.SmallSnake), "Property is required for class Capitalization."); if (capitalization.ATT_NAMEOption.IsSet) - writer.WriteString("ATT_NAME", capitalization.ATT_NAME); // 1 + writer.WriteString("ATT_NAME", capitalization.ATT_NAME); if (capitalization.CapitalCamelOption.IsSet) - writer.WriteString("CapitalCamel", capitalization.CapitalCamel); // 1 + writer.WriteString("CapitalCamel", capitalization.CapitalCamel); if (capitalization.CapitalSnakeOption.IsSet) - writer.WriteString("Capital_Snake", capitalization.CapitalSnake); // 1 + writer.WriteString("Capital_Snake", capitalization.CapitalSnake); if (capitalization.SCAETHFlowPointsOption.IsSet) - writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); // 1 + writer.WriteString("SCA_ETH_Flow_Points", capitalization.SCAETHFlowPoints); if (capitalization.SmallCamelOption.IsSet) - writer.WriteString("smallCamel", capitalization.SmallCamel); // 1 + writer.WriteString("smallCamel", capitalization.SmallCamel); if (capitalization.SmallSnakeOption.IsSet) - writer.WriteString("small_Snake", capitalization.SmallSnake); // 1 + writer.WriteString("small_Snake", capitalization.SmallSnake); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index fdc2d8924db2..527b12a3d4a2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -48,13 +48,13 @@ public Cat(string className, Option declawed = default, Option co /// Used to track the state of Declawed /// [JsonIgnore] - public Option DeclawedOption { get; private set; } // option d + public Option DeclawedOption { get; private set; } /// /// Gets or Sets Declawed /// [JsonPropertyName("declawed")] - public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new Option(value); } } // d + public bool? Declawed { get { return this. DeclawedOption; } set { this.DeclawedOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -140,7 +140,7 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value, declawed, color); // a + return new Cat(className.Value, declawed, color); } /// @@ -173,13 +173,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp if (cat.ColorOption.IsSet && cat.Color == null) throw new ArgumentNullException(nameof(cat.Color), "Property is required for class Cat."); - writer.WriteString("className", cat.ClassName); // 1 + writer.WriteString("className", cat.ClassName); if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); // 2 + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); if (cat.ColorOption.IsSet) - writer.WriteString("color", cat.Color); // 1 + writer.WriteString("color", cat.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 064beb238cca..c0488a98bdd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -48,19 +48,19 @@ public Category(string name = @"default-name", Option id = default) /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -156,7 +156,7 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value, id); // a + return new Category(name.Value, id); } /// @@ -186,10 +186,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); // 1 + writer.WriteString("name", category.Name); if (category.IdOption.IsSet) - writer.WriteNumber("id", category.IdOption.Value.Value); // 3 + writer.WriteNumber("id", category.IdOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index c220fd2fdbe3..531c5d0798b7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -100,25 +100,25 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] - public new Option PetTypeOption { get; private set; } // option a + public new Option PetTypeOption { get; private set; } /// /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new Option(value); } } // a + public new PetTypeEnum? PetType { get { return this.PetTypeOption; } set { this.PetTypeOption = new Option(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -196,7 +196,7 @@ public override ChildCat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ChildCat."); - return new ChildCat(name, petType); // a + return new ChildCat(name, petType); } /// @@ -227,9 +227,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ChildCat childCat, JsonSe throw new ArgumentNullException(nameof(childCat.Name), "Property is required for class ChildCat."); if (childCat.NameOption.IsSet) - writer.WriteString("name", childCat.Name); // 1 + writer.WriteString("name", childCat.Name); - var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); // 7 + var petTypeRawValue = ChildCat.PetTypeEnumToJsonValue(childCat.PetTypeOption.Value.Value); if (petTypeRawValue != null) writer.WriteString("pet_type", petTypeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index 87e9d678a638..26b73fda643f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -46,13 +46,13 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("_class")] - public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } // d + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override ClassModel Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (varClass.IsSet && varClass.Value == null) throw new ArgumentNullException(nameof(varClass), "Property is not nullable for class ClassModel."); - return new ClassModel(varClass); // a + return new ClassModel(varClass); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ClassModel classModel, Js throw new ArgumentNullException(nameof(classModel.VarClass), "Property is required for class ClassModel."); if (classModel.VarClassOption.IsSet) - writer.WriteString("_class", classModel.VarClass); // 1 + writer.WriteString("_class", classModel.VarClass); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs index 2ba439964da6..747b36ec65bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ComplexQuadrilateral.cs @@ -48,13 +48,13 @@ public ComplexQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override ComplexQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Typ if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ComplexQuadrilateral."); - return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); // a + return new ComplexQuadrilateral(quadrilateralType.Value, shapeType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ComplexQuadrilateral comp if (complexQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(complexQuadrilateral.ShapeType), "Property is required for class ComplexQuadrilateral."); - writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", complexQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", complexQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", complexQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs index 2310e9adb29f..c28634e4e13e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DanishPig.cs @@ -46,7 +46,7 @@ public DanishPig(string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override DanishPig Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class DanishPig."); - return new DanishPig(className.Value); // a + return new DanishPig(className.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DanishPig danishPig, Json if (danishPig.ClassName == null) throw new ArgumentNullException(nameof(danishPig.ClassName), "Property is required for class DanishPig."); - writer.WriteString("className", danishPig.ClassName); // 1 + writer.WriteString("className", danishPig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 747c241377cb..6bd2ac02a9af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -46,14 +46,14 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] - public Option DateOnlyPropertyOption { get; private set; } // option d + public Option DateOnlyPropertyOption { get; private set; } /// /// Gets or Sets DateOnlyProperty /// /// Fri Jul 21 00:00:00 UTC 2017 [JsonPropertyName("dateOnlyProperty")] - public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option(value); } } // d + public DateTime? DateOnlyProperty { get { return this. DateOnlyPropertyOption; } set { this.DateOnlyPropertyOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -143,7 +143,7 @@ public override DateOnlyClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (dateOnlyProperty.IsSet && dateOnlyProperty.Value == null) throw new ArgumentNullException(nameof(dateOnlyProperty), "Property is not nullable for class DateOnlyClass."); - return new DateOnlyClass(dateOnlyProperty); // a + return new DateOnlyClass(dateOnlyProperty); } /// @@ -171,7 +171,7 @@ public override void Write(Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, J public void WriteProperties(ref Utf8JsonWriter writer, DateOnlyClass dateOnlyClass, JsonSerializerOptions jsonSerializerOptions) { if (dateOnlyClass.DateOnlyPropertyOption.IsSet) - writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); // 4 + writer.WriteString("dateOnlyProperty", dateOnlyClass.DateOnlyPropertyOption.Value.Value.ToString(DateOnlyPropertyFormat)); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 008923f6c6e9..3e35b28521a2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -46,13 +46,13 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override DeprecatedObject Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class DeprecatedObject."); - return new DeprecatedObject(name); // a + return new DeprecatedObject(name); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, DeprecatedObject deprecat throw new ArgumentNullException(nameof(deprecatedObject.Name), "Property is required for class DeprecatedObject."); if (deprecatedObject.NameOption.IsSet) - writer.WriteString("name", deprecatedObject.Name); // 1 + writer.WriteString("name", deprecatedObject.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 57c61d2c5f46..977d6867dae3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -48,13 +48,13 @@ public Dog(string className, Option breed = default, Option colo /// Used to track the state of Breed /// [JsonIgnore] - public Option BreedOption { get; private set; } // option d + public Option BreedOption { get; private set; } /// /// Gets or Sets Breed /// [JsonPropertyName("breed")] - public string Breed { get { return this. BreedOption; } set { this.BreedOption = new Option(value); } } // d + public string Breed { get { return this. BreedOption; } set { this.BreedOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -139,7 +139,7 @@ public override Dog Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Dog."); - return new Dog(className.Value, breed, color); // a + return new Dog(className.Value, breed, color); } /// @@ -175,13 +175,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Dog dog, JsonSerializerOp if (dog.ColorOption.IsSet && dog.Color == null) throw new ArgumentNullException(nameof(dog.Color), "Property is required for class Dog."); - writer.WriteString("className", dog.ClassName); // 1 + writer.WriteString("className", dog.ClassName); if (dog.BreedOption.IsSet) - writer.WriteString("breed", dog.Breed); // 1 + writer.WriteString("breed", dog.Breed); if (dog.ColorOption.IsSet) - writer.WriteString("color", dog.Color); // 1 + writer.WriteString("color", dog.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 49e9e932bde3..527c50af78e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -52,49 +52,49 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of MainShape /// [JsonIgnore] - public Option MainShapeOption { get; private set; } // option d + public Option MainShapeOption { get; private set; } /// /// Gets or Sets MainShape /// [JsonPropertyName("mainShape")] - public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new Option(value); } } // d + public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new Option(value); } } /// /// Used to track the state of Shapes /// [JsonIgnore] - public Option> ShapesOption { get; private set; } // option d + public Option> ShapesOption { get; private set; } /// /// Gets or Sets Shapes /// [JsonPropertyName("shapes")] - public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new Option>(value); } } // d + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new Option>(value); } } /// /// Used to track the state of NullableShape /// [JsonIgnore] - public Option NullableShapeOption { get; private set; } // option d + public Option NullableShapeOption { get; private set; } /// /// Gets or Sets NullableShape /// [JsonPropertyName("nullableShape")] - public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new Option(value); } } // d + public NullableShape NullableShape { get { return this. NullableShapeOption; } set { this.NullableShapeOption = new Option(value); } } /// /// Used to track the state of ShapeOrNull /// [JsonIgnore] - public Option ShapeOrNullOption { get; private set; } // option d + public Option ShapeOrNullOption { get; private set; } /// /// Gets or Sets ShapeOrNull /// [JsonPropertyName("shapeOrNull")] - public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new Option(value); } } // d + public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -211,7 +211,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); // a + return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); } /// @@ -244,13 +244,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri if (drawing.ShapesOption.IsSet && drawing.Shapes == null) throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); - if (drawing.MainShapeOption.IsSet) // 14 + if (drawing.MainShapeOption.IsSet) writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); - if (drawing.ShapesOption.IsSet) // 14 + if (drawing.ShapesOption.IsSet) writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - if (drawing.NullableShapeOption.IsSet) // 14 + if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { writer.WritePropertyName("nullableShape"); @@ -258,7 +258,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("nullableShape"); - if (drawing.ShapeOrNullOption.IsSet) // 14 + if (drawing.ShapeOrNullOption.IsSet) if (drawing.ShapeOrNullOption.Value != null) { writer.WritePropertyName("shapeOrNull"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index a12c39749cbf..8517a7937c4c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -180,25 +180,25 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] - public Option JustSymbolOption { get; private set; } // option a + public Option JustSymbolOption { get; private set; } /// /// Gets or Sets JustSymbol /// [JsonPropertyName("just_symbol")] - public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new Option(value); } } // a + public JustSymbolEnum? JustSymbol { get { return this.JustSymbolOption; } set { this.JustSymbolOption = new Option(value); } } /// /// Used to track the state of ArrayEnum /// [JsonIgnore] - public Option> ArrayEnumOption { get; private set; } // option d + public Option> ArrayEnumOption { get; private set; } /// /// Gets or Sets ArrayEnum /// [JsonPropertyName("array_enum")] - public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new Option>(value); } } // d + public List ArrayEnum { get { return this. ArrayEnumOption; } set { this.ArrayEnumOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -293,7 +293,7 @@ public override EnumArrays Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justSymbol.IsSet && justSymbol.Value == null) throw new ArgumentNullException(nameof(justSymbol), "Property is not nullable for class EnumArrays."); - return new EnumArrays(arrayEnum, justSymbol); // a + return new EnumArrays(arrayEnum, justSymbol); } /// @@ -323,10 +323,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js if (enumArrays.ArrayEnumOption.IsSet && enumArrays.ArrayEnum == null) throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); - if (enumArrays.ArrayEnumOption.IsSet) // 14 + if (enumArrays.ArrayEnumOption.IsSet) writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); - var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); // 7 + var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index fc7a9e9fc812..cbc244d9a164 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -212,7 +212,7 @@ public static string EnumStringRequiredEnumToJsonValue(EnumStringRequiredEnum va /// Gets or Sets EnumStringRequired /// [JsonPropertyName("enum_string_required")] - public EnumStringRequiredEnum EnumStringRequired { get; set; } // a + public EnumStringRequiredEnum EnumStringRequired { get; set; } /// /// Defines EnumInteger @@ -277,13 +277,13 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] - public Option EnumIntegerOption { get; private set; } // option a + public Option EnumIntegerOption { get; private set; } /// /// Gets or Sets EnumInteger /// [JsonPropertyName("enum_integer")] - public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new Option(value); } } // a + public EnumIntegerEnum? EnumInteger { get { return this.EnumIntegerOption; } set { this.EnumIntegerOption = new Option(value); } } /// /// Defines EnumIntegerOnly @@ -348,13 +348,13 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] - public Option EnumIntegerOnlyOption { get; private set; } // option a + public Option EnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets EnumIntegerOnly /// [JsonPropertyName("enum_integer_only")] - public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new Option(value); } } // a + public EnumIntegerOnlyEnum? EnumIntegerOnly { get { return this.EnumIntegerOnlyOption; } set { this.EnumIntegerOnlyOption = new Option(value); } } /// /// Defines EnumNumber @@ -426,13 +426,13 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] - public Option EnumNumberOption { get; private set; } // option a + public Option EnumNumberOption { get; private set; } /// /// Gets or Sets EnumNumber /// [JsonPropertyName("enum_number")] - public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new Option(value); } } // a + public EnumNumberEnum? EnumNumber { get { return this.EnumNumberOption; } set { this.EnumNumberOption = new Option(value); } } /// /// Defines EnumString @@ -588,61 +588,61 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] - public Option EnumStringOption { get; private set; } // option a + public Option EnumStringOption { get; private set; } /// /// Gets or Sets EnumString /// [JsonPropertyName("enum_string")] - public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new Option(value); } } // a + public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new Option(value); } } /// /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] - public Option OuterEnumDefaultValueOption { get; private set; } // option a + public Option OuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumDefaultValue /// [JsonPropertyName("outerEnumDefaultValue")] - public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new Option(value); } } // a + public OuterEnumDefaultValue? OuterEnumDefaultValue { get { return this.OuterEnumDefaultValueOption; } set { this.OuterEnumDefaultValueOption = new Option(value); } } /// /// Used to track the state of OuterEnumInteger /// [JsonIgnore] - public Option OuterEnumIntegerOption { get; private set; } // option a + public Option OuterEnumIntegerOption { get; private set; } /// /// Gets or Sets OuterEnumInteger /// [JsonPropertyName("outerEnumInteger")] - public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new Option(value); } } // a + public OuterEnumInteger? OuterEnumInteger { get { return this.OuterEnumIntegerOption; } set { this.OuterEnumIntegerOption = new Option(value); } } /// /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] - public Option OuterEnumIntegerDefaultValueOption { get; private set; } // option a + public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// /// Gets or Sets OuterEnumIntegerDefaultValue /// [JsonPropertyName("outerEnumIntegerDefaultValue")] - public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new Option(value); } } // a + public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new Option(value); } } /// /// Used to track the state of OuterEnum /// [JsonIgnore] - public Option OuterEnumOption { get; private set; } // option a + public Option OuterEnumOption { get; private set; } /// /// Gets or Sets OuterEnum /// [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new Option(value); } } // a + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -805,7 +805,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); // a + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); } /// @@ -832,46 +832,46 @@ public override void Write(Utf8JsonWriter writer, EnumTest enumTest, JsonSeriali /// public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSerializerOptions jsonSerializerOptions) { - var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); // 7 + var enumStringRequiredRawValue = EnumTest.EnumStringRequiredEnumToJsonValue(enumTest.EnumStringRequired); if (enumStringRequiredRawValue != null) writer.WriteString("enum_string_required", enumStringRequiredRawValue); else writer.WriteNull("enum_string_required"); if (enumTest.EnumIntegerOption.IsSet) - writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("enum_integer", EnumTest.EnumIntegerEnumToJsonValue(enumTest.EnumIntegerOption.Value.Value)); if (enumTest.EnumIntegerOnlyOption.IsSet) - writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("enum_integer_only", EnumTest.EnumIntegerOnlyEnumToJsonValue(enumTest.EnumIntegerOnlyOption.Value.Value)); if (enumTest.EnumNumberOption.IsSet) - writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); // 6 + writer.WriteNumber("enum_number", EnumTest.EnumNumberEnumToJsonValue(enumTest.EnumNumberOption.Value.Value)); - var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); // 7 + var enumStringRawValue = EnumTest.EnumStringEnumToJsonValue(enumTest.EnumStringOption.Value.Value); if (enumStringRawValue != null) writer.WriteString("enum_string", enumStringRawValue); else writer.WriteNull("enum_string"); - if (enumTest.OuterEnumDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumDefaultValueOption.IsSet) { - var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); // 10 b + var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); writer.WriteString("outerEnumDefaultValue", outerEnumDefaultValueRawValue); } - if (enumTest.OuterEnumIntegerOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerOption.IsSet) { - var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); // 10 b + var outerEnumIntegerRawValue = OuterEnumIntegerValueConverter.ToJsonValue(enumTest.OuterEnumInteger.Value); writer.WriteNumber("outerEnumInteger", outerEnumIntegerRawValue); } - if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) // 10 + if (enumTest.OuterEnumIntegerDefaultValueOption.IsSet) { - var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); // 10 b + var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) // 10 - if (enumTest.OuterEnumOption.Value != null) // 10 a + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); // 10 c + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); writer.WriteString("outerEnum", outerEnumRawValue); } else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs index 7e719d26f712..bbf4bf8f8e09 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EquilateralTriangle.cs @@ -48,13 +48,13 @@ public EquilateralTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override EquilateralTriangle Read(ref Utf8JsonReader utf8JsonReader, Type if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class EquilateralTriangle."); - return new EquilateralTriangle(shapeType.Value, triangleType.Value); // a + return new EquilateralTriangle(shapeType.Value, triangleType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, EquilateralTriangle equil if (equilateralTriangle.TriangleType == null) throw new ArgumentNullException(nameof(equilateralTriangle.TriangleType), "Property is required for class EquilateralTriangle."); - writer.WriteString("shapeType", equilateralTriangle.ShapeType); // 1 + writer.WriteString("shapeType", equilateralTriangle.ShapeType); - writer.WriteString("triangleType", equilateralTriangle.TriangleType); // 1 + writer.WriteString("triangleType", equilateralTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 2f8220a98e63..8b49ccc48188 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -46,14 +46,14 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] - public Option SourceURIOption { get; private set; } // option d + public Option SourceURIOption { get; private set; } /// /// Test capitalization /// /// Test capitalization [JsonPropertyName("sourceURI")] - public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new Option(value); } } // d + public string SourceURI { get { return this. SourceURIOption; } set { this.SourceURIOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override File Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (sourceURI.IsSet && sourceURI.Value == null) throw new ArgumentNullException(nameof(sourceURI), "Property is not nullable for class File."); - return new File(sourceURI); // a + return new File(sourceURI); } /// @@ -168,7 +168,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, File file, JsonSerializer throw new ArgumentNullException(nameof(file.SourceURI), "Property is required for class File."); if (file.SourceURIOption.IsSet) - writer.WriteString("sourceURI", file.SourceURI); // 1 + writer.WriteString("sourceURI", file.SourceURI); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 7512805430de..9afb1e2575bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -48,25 +48,25 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of File /// [JsonIgnore] - public Option FileOption { get; private set; } // option d + public Option FileOption { get; private set; } /// /// Gets or Sets File /// [JsonPropertyName("file")] - public File File { get { return this. FileOption; } set { this.FileOption = new Option(value); } } // d + public File File { get { return this. FileOption; } set { this.FileOption = new Option(value); } } /// /// Used to track the state of Files /// [JsonIgnore] - public Option> FilesOption { get; private set; } // option d + public Option> FilesOption { get; private set; } /// /// Gets or Sets Files /// [JsonPropertyName("files")] - public List Files { get { return this. FilesOption; } set { this.FilesOption = new Option>(value); } } // d + public List Files { get { return this. FilesOption; } set { this.FilesOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -160,7 +160,7 @@ public override FileSchemaTestClass Read(ref Utf8JsonReader utf8JsonReader, Type if (files.IsSet && files.Value == null) throw new ArgumentNullException(nameof(files), "Property is not nullable for class FileSchemaTestClass."); - return new FileSchemaTestClass(file, files); // a + return new FileSchemaTestClass(file, files); } /// @@ -193,10 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS if (fileSchemaTestClass.FilesOption.IsSet && fileSchemaTestClass.Files == null) throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); - if (fileSchemaTestClass.FileOption.IsSet) // 14 + if (fileSchemaTestClass.FileOption.IsSet) writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); - if (fileSchemaTestClass.FilesOption.IsSet) // 14 + if (fileSchemaTestClass.FilesOption.IsSet) writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index e99ebbb9798e..5643834b58d6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -46,13 +46,13 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; private set; } // option d + public Option BarOption { get; private set; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } set { this.BarOption = new Option(value); } } // d + public string Bar { get { return this. BarOption; } set { this.BarOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override Foo Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (bar.IsSet && bar.Value == null) throw new ArgumentNullException(nameof(bar), "Property is not nullable for class Foo."); - return new Foo(bar); // a + return new Foo(bar); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Foo foo, JsonSerializerOp throw new ArgumentNullException(nameof(foo.Bar), "Property is required for class Foo."); if (foo.BarOption.IsSet) - writer.WriteString("bar", foo.Bar); // 1 + writer.WriteString("bar", foo.Bar); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 7bc572772cfa..07c6b69c2b19 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -46,13 +46,13 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } // d + public Foo VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override FooGetDefaultResponse Read(ref Utf8JsonReader utf8JsonReader, Ty if (varString.IsSet && varString.Value == null) throw new ArgumentNullException(nameof(varString), "Property is not nullable for class FooGetDefaultResponse."); - return new FooGetDefaultResponse(varString); // a + return new FooGetDefaultResponse(varString); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo if (fooGetDefaultResponse.VarStringOption.IsSet && fooGetDefaultResponse.VarString == null) throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); - if (fooGetDefaultResponse.VarStringOption.IsSet) // 14 + if (fooGetDefaultResponse.VarStringOption.IsSet) writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index b80db04cfbf1..dfe8433034cd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -82,211 +82,211 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Gets or Sets VarByte /// [JsonPropertyName("byte")] - public byte[] VarByte { get; set; } // d + public byte[] VarByte { get; set; } /// /// Gets or Sets Date /// /// Sun Feb 02 00:00:00 UTC 2020 [JsonPropertyName("date")] - public DateTime Date { get; set; } // d + public DateTime Date { get; set; } /// /// Gets or Sets Number /// [JsonPropertyName("number")] - public decimal Number { get; set; } // d + public decimal Number { get; set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get; set; } // d + public string Password { get; set; } /// /// Used to track the state of Binary /// [JsonIgnore] - public Option BinaryOption { get; private set; } // option d + public Option BinaryOption { get; private set; } /// /// Gets or Sets Binary /// [JsonPropertyName("binary")] - public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new Option(value); } } // d + public System.IO.Stream Binary { get { return this. BinaryOption; } set { this.BinaryOption = new Option(value); } } /// /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// /// 2007-12-03T10:15:30+01:00 [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } /// /// Used to track the state of VarDecimal /// [JsonIgnore] - public Option VarDecimalOption { get; private set; } // option d + public Option VarDecimalOption { get; private set; } /// /// Gets or Sets VarDecimal /// [JsonPropertyName("decimal")] - public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new Option(value); } } // d + public decimal? VarDecimal { get { return this. VarDecimalOption; } set { this.VarDecimalOption = new Option(value); } } /// /// Used to track the state of VarDouble /// [JsonIgnore] - public Option VarDoubleOption { get; private set; } // option d + public Option VarDoubleOption { get; private set; } /// /// Gets or Sets VarDouble /// [JsonPropertyName("double")] - public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new Option(value); } } // d + public double? VarDouble { get { return this. VarDoubleOption; } set { this.VarDoubleOption = new Option(value); } } /// /// Used to track the state of VarFloat /// [JsonIgnore] - public Option VarFloatOption { get; private set; } // option d + public Option VarFloatOption { get; private set; } /// /// Gets or Sets VarFloat /// [JsonPropertyName("float")] - public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new Option(value); } } // d + public float? VarFloat { get { return this. VarFloatOption; } set { this.VarFloatOption = new Option(value); } } /// /// Used to track the state of Int32 /// [JsonIgnore] - public Option Int32Option { get; private set; } // option d + public Option Int32Option { get; private set; } /// /// Gets or Sets Int32 /// [JsonPropertyName("int32")] - public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new Option(value); } } // d + public int? Int32 { get { return this. Int32Option; } set { this.Int32Option = new Option(value); } } /// /// Used to track the state of Int64 /// [JsonIgnore] - public Option Int64Option { get; private set; } // option d + public Option Int64Option { get; private set; } /// /// Gets or Sets Int64 /// [JsonPropertyName("int64")] - public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new Option(value); } } // d + public long? Int64 { get { return this. Int64Option; } set { this.Int64Option = new Option(value); } } /// /// Used to track the state of Integer /// [JsonIgnore] - public Option IntegerOption { get; private set; } // option d + public Option IntegerOption { get; private set; } /// /// Gets or Sets Integer /// [JsonPropertyName("integer")] - public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new Option(value); } } // d + public int? Integer { get { return this. IntegerOption; } set { this.IntegerOption = new Option(value); } } /// /// Used to track the state of PatternWithBackslash /// [JsonIgnore] - public Option PatternWithBackslashOption { get; private set; } // option d + public Option PatternWithBackslashOption { get; private set; } /// /// None /// /// None [JsonPropertyName("pattern_with_backslash")] - public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new Option(value); } } // d + public string PatternWithBackslash { get { return this. PatternWithBackslashOption; } set { this.PatternWithBackslashOption = new Option(value); } } /// /// Used to track the state of PatternWithDigits /// [JsonIgnore] - public Option PatternWithDigitsOption { get; private set; } // option d + public Option PatternWithDigitsOption { get; private set; } /// /// A string that is a 10 digit number. Can have leading zeros. /// /// A string that is a 10 digit number. Can have leading zeros. [JsonPropertyName("pattern_with_digits")] - public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new Option(value); } } // d + public string PatternWithDigits { get { return this. PatternWithDigitsOption; } set { this.PatternWithDigitsOption = new Option(value); } } /// /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] - public Option PatternWithDigitsAndDelimiterOption { get; private set; } // option d + public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. /// /// A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. [JsonPropertyName("pattern_with_digits_and_delimiter")] - public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new Option(value); } } // d + public string PatternWithDigitsAndDelimiter { get { return this. PatternWithDigitsAndDelimiterOption; } set { this.PatternWithDigitsAndDelimiterOption = new Option(value); } } /// /// Used to track the state of VarString /// [JsonIgnore] - public Option VarStringOption { get; private set; } // option d + public Option VarStringOption { get; private set; } /// /// Gets or Sets VarString /// [JsonPropertyName("string")] - public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } // d + public string VarString { get { return this. VarStringOption; } set { this.VarStringOption = new Option(value); } } /// /// Used to track the state of UnsignedInteger /// [JsonIgnore] - public Option UnsignedIntegerOption { get; private set; } // option d + public Option UnsignedIntegerOption { get; private set; } /// /// Gets or Sets UnsignedInteger /// [JsonPropertyName("unsigned_integer")] - public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new Option(value); } } // d + public uint? UnsignedInteger { get { return this. UnsignedIntegerOption; } set { this.UnsignedIntegerOption = new Option(value); } } /// /// Used to track the state of UnsignedLong /// [JsonIgnore] - public Option UnsignedLongOption { get; private set; } // option d + public Option UnsignedLongOption { get; private set; } /// /// Gets or Sets UnsignedLong /// [JsonPropertyName("unsigned_long")] - public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new Option(value); } } // d + public ulong? UnsignedLong { get { return this. UnsignedLongOption; } set { this.UnsignedLongOption = new Option(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -674,7 +674,7 @@ public override FormatTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class FormatTest."); - return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); // a + return new FormatTest(varByte.Value, date.Value.Value, number.Value.Value, password.Value, binary, dateTime, varDecimal, varDouble, varFloat, int32, int64, integer, patternWithBackslash, patternWithDigits, patternWithDigitsAndDelimiter, varString, unsignedInteger, unsignedLong, uuid); } /// @@ -723,57 +723,57 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js throw new ArgumentNullException(nameof(formatTest.VarString), "Property is required for class FormatTest."); writer.WritePropertyName("byte"); - JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); // 13 - writer.WriteString("date", formatTest.Date.ToString(DateFormat)); // 4 + JsonSerializer.Serialize(writer, formatTest.VarByte, jsonSerializerOptions); + writer.WriteString("date", formatTest.Date.ToString(DateFormat)); - writer.WriteNumber("number", formatTest.Number); // 3 + writer.WriteNumber("number", formatTest.Number); - writer.WriteString("password", formatTest.Password); // 1 + writer.WriteString("password", formatTest.Password); - if (formatTest.BinaryOption.IsSet) // 14 + if (formatTest.BinaryOption.IsSet) writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); if (formatTest.DateTimeOption.IsSet) - writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); - if (formatTest.VarDecimalOption.IsSet) // 14 + if (formatTest.VarDecimalOption.IsSet) writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); if (formatTest.VarDoubleOption.IsSet) - writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); // 3 + writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); if (formatTest.VarFloatOption.IsSet) - writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); // 3 + writer.WriteNumber("float", formatTest.VarFloatOption.Value.Value); if (formatTest.Int32Option.IsSet) - writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); // 3 + writer.WriteNumber("int32", formatTest.Int32Option.Value.Value); if (formatTest.Int64Option.IsSet) - writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); // 3 + writer.WriteNumber("int64", formatTest.Int64Option.Value.Value); if (formatTest.IntegerOption.IsSet) - writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); // 3 + writer.WriteNumber("integer", formatTest.IntegerOption.Value.Value); if (formatTest.PatternWithBackslashOption.IsSet) - writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); // 1 + writer.WriteString("pattern_with_backslash", formatTest.PatternWithBackslash); if (formatTest.PatternWithDigitsOption.IsSet) - writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); // 1 + writer.WriteString("pattern_with_digits", formatTest.PatternWithDigits); if (formatTest.PatternWithDigitsAndDelimiterOption.IsSet) - writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); // 1 + writer.WriteString("pattern_with_digits_and_delimiter", formatTest.PatternWithDigitsAndDelimiter); if (formatTest.VarStringOption.IsSet) - writer.WriteString("string", formatTest.VarString); // 1 + writer.WriteString("string", formatTest.VarString); if (formatTest.UnsignedIntegerOption.IsSet) - writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); // 3 + writer.WriteNumber("unsigned_integer", formatTest.UnsignedIntegerOption.Value.Value); if (formatTest.UnsignedLongOption.IsSet) - writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); // 3 + writer.WriteNumber("unsigned_long", formatTest.UnsignedLongOption.Value.Value); if (formatTest.UuidOption.IsSet) - writer.WriteString("uuid", formatTest.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", formatTest.UuidOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index 603a7d932b2f..a9939e84aa0c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -69,13 +69,13 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -175,10 +175,10 @@ public override Fruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(color), "Property is not nullable for class Fruit."); if (apple != null) - return new Fruit(apple, color); // b + return new Fruit(apple, color); if (banana != null) - return new Fruit(banana, color); // b + return new Fruit(banana, color); throw new JsonException(); } @@ -211,7 +211,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Fruit fruit, JsonSerializ throw new ArgumentNullException(nameof(fruit.Color), "Property is required for class Fruit."); if (fruit.ColorOption.IsSet) - writer.WriteString("color", fruit.Color); // 1 + writer.WriteString("color", fruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs index 7fd5e012fc5e..75652a1b436e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FruitReq.cs @@ -150,10 +150,10 @@ public override FruitReq Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv } if (appleReq != null) - return new FruitReq(appleReq); // b + return new FruitReq(appleReq); if (bananaReq != null) - return new FruitReq(bananaReq); // b + return new FruitReq(bananaReq); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index d31a9f7bd6ff..6043820f85ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -49,35 +49,35 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] - public Option AppleOption { get; private set; } // option b + public Option AppleOption { get; private set; } /// /// Gets or Sets Apple /// - public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new Option(value); } } // b + public Apple Apple { get { return this.AppleOption; } set { this.AppleOption = new Option(value); } } /// /// Used to track the state of Banana /// [JsonIgnore] - public Option BananaOption { get; private set; } // option b + public Option BananaOption { get; private set; } /// /// Gets or Sets Banana /// - public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new Option(value); } } // b + public Banana Banana { get { return this.BananaOption; } set { this.BananaOption = new Option(value); } } /// /// Used to track the state of Color /// [JsonIgnore] - public Option ColorOption { get; private set; } // option d + public Option ColorOption { get; private set; } /// /// Gets or Sets Color /// [JsonPropertyName("color")] - public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } // d + public string Color { get { return this. ColorOption; } set { this.ColorOption = new Option(value); } } /// /// Returns the string presentation of the object @@ -183,7 +183,7 @@ public override GmFruit Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve ? default : new Option(banana); - return new GmFruit(appleParsedValue, bananaParsedValue, color); // a + return new GmFruit(appleParsedValue, bananaParsedValue, color); } /// @@ -226,7 +226,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GmFruit gmFruit, JsonSeri throw new ArgumentNullException(nameof(gmFruit.Color), "Property is required for class GmFruit."); if (gmFruit.ColorOption.IsSet) - writer.WriteString("color", gmFruit.Color); // 1 + writer.WriteString("color", gmFruit.Color); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs index 104b1e543cd8..6b7d7ae8da68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GrandparentAnimal.cs @@ -46,7 +46,7 @@ public GrandparentAnimal(string petType) /// Gets or Sets PetType /// [JsonPropertyName("pet_type")] - public string PetType { get; set; } // d + public string PetType { get; set; } /// /// Gets or Sets additional properties @@ -143,7 +143,7 @@ public override GrandparentAnimal Read(ref Utf8JsonReader utf8JsonReader, Type t if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class GrandparentAnimal."); - return new GrandparentAnimal(petType.Value); // a + return new GrandparentAnimal(petType.Value); } /// @@ -173,7 +173,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, GrandparentAnimal grandpa if (grandparentAnimal.PetType == null) throw new ArgumentNullException(nameof(grandparentAnimal.PetType), "Property is required for class GrandparentAnimal."); - writer.WriteString("pet_type", grandparentAnimal.PetType); // 1 + writer.WriteString("pet_type", grandparentAnimal.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index ba871e18b903..ea29e35293ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -48,25 +48,25 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } } // d + public string Bar { get { return this. BarOption; } } /// /// Used to track the state of Foo /// [JsonIgnore] - public Option FooOption { get; } // option d + public Option FooOption { get; } /// /// Gets or Sets Foo /// [JsonPropertyName("foo")] - public string Foo { get { return this. FooOption; } } // d + public string Foo { get { return this. FooOption; } } /// /// Gets or Sets additional properties @@ -199,7 +199,7 @@ public override HasOnlyReadOnly Read(ref Utf8JsonReader utf8JsonReader, Type typ if (foo.IsSet && foo.Value == null) throw new ArgumentNullException(nameof(foo), "Property is not nullable for class HasOnlyReadOnly."); - return new HasOnlyReadOnly(bar, foo); // a + return new HasOnlyReadOnly(bar, foo); } /// @@ -233,10 +233,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, HasOnlyReadOnly hasOnlyRe throw new ArgumentNullException(nameof(hasOnlyReadOnly.Foo), "Property is required for class HasOnlyReadOnly."); if (hasOnlyReadOnly.BarOption.IsSet) - writer.WriteString("bar", hasOnlyReadOnly.Bar); // 1 + writer.WriteString("bar", hasOnlyReadOnly.Bar); if (hasOnlyReadOnly.FooOption.IsSet) - writer.WriteString("foo", hasOnlyReadOnly.Foo); // 1 + writer.WriteString("foo", hasOnlyReadOnly.Foo); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 44558f1b7589..2bd4dc077f11 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -46,13 +46,13 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] - public Option NullableMessageOption { get; private set; } // option d + public Option NullableMessageOption { get; private set; } /// /// Gets or Sets NullableMessage /// [JsonPropertyName("NullableMessage")] - public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new Option(value); } } // d + public string NullableMessage { get { return this. NullableMessageOption; } set { this.NullableMessageOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override HealthCheckResult Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new HealthCheckResult(nullableMessage); // a + return new HealthCheckResult(nullableMessage); } /// @@ -162,7 +162,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, HealthCheckResult healthC { if (healthCheckResult.NullableMessageOption.IsSet) if (healthCheckResult.NullableMessageOption.Value != null) - writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); // 1 + writer.WriteString("NullableMessage", healthCheckResult.NullableMessage); else writer.WriteNull("NullableMessage"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs index f28b3dceafe5..3f4aa3229c4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/IsoscelesTriangle.cs @@ -48,13 +48,13 @@ public IsoscelesTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Returns the string presentation of the object @@ -145,7 +145,7 @@ public override IsoscelesTriangle Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class IsoscelesTriangle."); - return new IsoscelesTriangle(shapeType.Value, triangleType.Value); // a + return new IsoscelesTriangle(shapeType.Value, triangleType.Value); } /// @@ -178,9 +178,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, IsoscelesTriangle isoscel if (isoscelesTriangle.TriangleType == null) throw new ArgumentNullException(nameof(isoscelesTriangle.TriangleType), "Property is required for class IsoscelesTriangle."); - writer.WriteString("shapeType", isoscelesTriangle.ShapeType); // 1 + writer.WriteString("shapeType", isoscelesTriangle.ShapeType); - writer.WriteString("triangleType", isoscelesTriangle.TriangleType); // 1 + writer.WriteString("triangleType", isoscelesTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index 0c6e2036c832..ff2cc44b489b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -46,13 +46,13 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] - public Option Var123ListOption { get; private set; } // option d + public Option Var123ListOption { get; private set; } /// /// Gets or Sets Var123List /// [JsonPropertyName("123-list")] - public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new Option(value); } } // d + public string Var123List { get { return this. Var123ListOption; } set { this.Var123ListOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override List Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123List.IsSet && var123List.Value == null) throw new ArgumentNullException(nameof(var123List), "Property is not nullable for class List."); - return new List(var123List); // a + return new List(var123List); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, List list, JsonSerializer throw new ArgumentNullException(nameof(list.Var123List), "Property is required for class List."); if (list.Var123ListOption.IsSet) - writer.WriteString("123-list", list.Var123List); // 1 + writer.WriteString("123-list", list.Var123List); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 776eacbd52bd..00114f12354c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -48,25 +48,25 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of EscapedLiteralString /// [JsonIgnore] - public Option EscapedLiteralStringOption { get; private set; } // option d + public Option EscapedLiteralStringOption { get; private set; } /// /// Gets or Sets EscapedLiteralString /// [JsonPropertyName("escapedLiteralString")] - public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new Option(value); } } // d + public string EscapedLiteralString { get { return this. EscapedLiteralStringOption; } set { this.EscapedLiteralStringOption = new Option(value); } } /// /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] - public Option UnescapedLiteralStringOption { get; private set; } // option d + public Option UnescapedLiteralStringOption { get; private set; } /// /// Gets or Sets UnescapedLiteralString /// [JsonPropertyName("unescapedLiteralString")] - public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new Option(value); } } // d + public string UnescapedLiteralString { get { return this. UnescapedLiteralStringOption; } set { this.UnescapedLiteralStringOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -158,7 +158,7 @@ public override LiteralStringClass Read(ref Utf8JsonReader utf8JsonReader, Type if (unescapedLiteralString.IsSet && unescapedLiteralString.Value == null) throw new ArgumentNullException(nameof(unescapedLiteralString), "Property is not nullable for class LiteralStringClass."); - return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); // a + return new LiteralStringClass(escapedLiteralString, unescapedLiteralString); } /// @@ -192,10 +192,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, LiteralStringClass litera throw new ArgumentNullException(nameof(literalStringClass.UnescapedLiteralString), "Property is required for class LiteralStringClass."); if (literalStringClass.EscapedLiteralStringOption.IsSet) - writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); // 1 + writer.WriteString("escapedLiteralString", literalStringClass.EscapedLiteralString); if (literalStringClass.UnescapedLiteralStringOption.IsSet) - writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); // 1 + writer.WriteString("unescapedLiteralString", literalStringClass.UnescapedLiteralString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs index 14518765c768..1ea0d944f050 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Mammal.cs @@ -86,7 +86,7 @@ public Mammal(Pig pig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -223,13 +223,13 @@ public override Mammal Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver throw new ArgumentNullException(nameof(className), "Property is not nullable for class Mammal."); if (pig != null) - return new Mammal(pig, className.Value); // c + return new Mammal(pig, className.Value); if (whale != null) - return new Mammal(whale, className.Value); // c + return new Mammal(whale, className.Value); if (zebra != null) - return new Mammal(zebra, className.Value); // c + return new Mammal(zebra, className.Value); throw new JsonException(); } @@ -276,7 +276,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Mammal mammal, JsonSerial if (mammal.ClassName == null) throw new ArgumentNullException(nameof(mammal.ClassName), "Property is required for class Mammal."); - writer.WriteString("className", mammal.ClassName); // 1 + writer.WriteString("className", mammal.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index ec36bb84e367..bcb3ca50b727 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -118,49 +118,49 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of DirectMap /// [JsonIgnore] - public Option> DirectMapOption { get; private set; } // option d + public Option> DirectMapOption { get; private set; } /// /// Gets or Sets DirectMap /// [JsonPropertyName("direct_map")] - public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new Option>(value); } } // d + public Dictionary DirectMap { get { return this. DirectMapOption; } set { this.DirectMapOption = new Option>(value); } } /// /// Used to track the state of IndirectMap /// [JsonIgnore] - public Option> IndirectMapOption { get; private set; } // option d + public Option> IndirectMapOption { get; private set; } /// /// Gets or Sets IndirectMap /// [JsonPropertyName("indirect_map")] - public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new Option>(value); } } // d + public Dictionary IndirectMap { get { return this. IndirectMapOption; } set { this.IndirectMapOption = new Option>(value); } } /// /// Used to track the state of MapMapOfString /// [JsonIgnore] - public Option>> MapMapOfStringOption { get; private set; } // option d + public Option>> MapMapOfStringOption { get; private set; } /// /// Gets or Sets MapMapOfString /// [JsonPropertyName("map_map_of_string")] - public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new Option>>(value); } } // d + public Dictionary> MapMapOfString { get { return this. MapMapOfStringOption; } set { this.MapMapOfStringOption = new Option>>(value); } } /// /// Used to track the state of MapOfEnumString /// [JsonIgnore] - public Option> MapOfEnumStringOption { get; private set; } // option d + public Option> MapOfEnumStringOption { get; private set; } /// /// Gets or Sets MapOfEnumString /// [JsonPropertyName("map_of_enum_string")] - public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new Option>(value); } } // d + public Dictionary MapOfEnumString { get { return this. MapOfEnumStringOption; } set { this.MapOfEnumStringOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -272,7 +272,7 @@ public override MapTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (mapOfEnumString.IsSet && mapOfEnumString.Value == null) throw new ArgumentNullException(nameof(mapOfEnumString), "Property is not nullable for class MapTest."); - return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); // a + return new MapTest(directMap, indirectMap, mapMapOfString, mapOfEnumString); } /// @@ -311,16 +311,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri if (mapTest.MapOfEnumStringOption.IsSet && mapTest.MapOfEnumString == null) throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); - if (mapTest.DirectMapOption.IsSet) // 14 + if (mapTest.DirectMapOption.IsSet) writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); - if (mapTest.IndirectMapOption.IsSet) // 14 + if (mapTest.IndirectMapOption.IsSet) writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); - if (mapTest.MapMapOfStringOption.IsSet) // 14 + if (mapTest.MapMapOfStringOption.IsSet) writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); - if (mapTest.MapOfEnumStringOption.IsSet) // 14 + if (mapTest.MapOfEnumStringOption.IsSet) writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 3848e1274944..c2f1278cd29e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -52,49 +52,49 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] - public Option DateTimeOption { get; private set; } // option d + public Option DateTimeOption { get; private set; } /// /// Gets or Sets DateTime /// [JsonPropertyName("dateTime")] - public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } // d + public DateTime? DateTime { get { return this. DateTimeOption; } set { this.DateTimeOption = new Option(value); } } /// /// Used to track the state of Map /// [JsonIgnore] - public Option> MapOption { get; private set; } // option d + public Option> MapOption { get; private set; } /// /// Gets or Sets Map /// [JsonPropertyName("map")] - public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new Option>(value); } } // d + public Dictionary Map { get { return this. MapOption; } set { this.MapOption = new Option>(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } /// /// Used to track the state of UuidWithPattern /// [JsonIgnore] - public Option UuidWithPatternOption { get; private set; } // option d + public Option UuidWithPatternOption { get; private set; } /// /// Gets or Sets UuidWithPattern /// [JsonPropertyName("uuid_with_pattern")] - public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new Option(value); } } // d + public Guid? UuidWithPattern { get { return this. UuidWithPatternOption; } set { this.UuidWithPatternOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -218,7 +218,7 @@ public override MixedPropertiesAndAdditionalPropertiesClass Read(ref Utf8JsonRea if (uuidWithPattern.IsSet && uuidWithPattern.Value == null) throw new ArgumentNullException(nameof(uuidWithPattern), "Property is not nullable for class MixedPropertiesAndAdditionalPropertiesClass."); - return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); // a + return new MixedPropertiesAndAdditionalPropertiesClass(dateTime, map, uuid, uuidWithPattern); } /// @@ -249,16 +249,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio throw new ArgumentNullException(nameof(mixedPropertiesAndAdditionalPropertiesClass.Map), "Property is required for class MixedPropertiesAndAdditionalPropertiesClass."); if (mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.IsSet) - writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); // 5 + writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); - if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) // 14 + if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) - writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); if (mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.IsSet) - writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); // 11 + writer.WriteString("uuid_with_pattern", mixedPropertiesAndAdditionalPropertiesClass.UuidWithPatternOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 6f84537a55ea..4146f3d0ea53 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -48,25 +48,25 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of VarClass /// [JsonIgnore] - public Option VarClassOption { get; private set; } // option d + public Option VarClassOption { get; private set; } /// /// Gets or Sets VarClass /// [JsonPropertyName("class")] - public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } // d + public string VarClass { get { return this. VarClassOption; } set { this.VarClassOption = new Option(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public int? Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d + public int? Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override Model200Response Read(ref Utf8JsonReader utf8JsonReader, Type ty if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Model200Response."); - return new Model200Response(varClass, name); // a + return new Model200Response(varClass, name); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Model200Response model200 throw new ArgumentNullException(nameof(model200Response.VarClass), "Property is required for class Model200Response."); if (model200Response.VarClassOption.IsSet) - writer.WriteString("class", model200Response.VarClass); // 1 + writer.WriteString("class", model200Response.VarClass); if (model200Response.NameOption.IsSet) - writer.WriteNumber("name", model200Response.NameOption.Value.Value); // 3 + writer.WriteNumber("name", model200Response.NameOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index cecadeaa6fe7..78e157c3579c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -46,13 +46,13 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] - public Option VarClientOption { get; private set; } // option d + public Option VarClientOption { get; private set; } /// /// Gets or Sets VarClient /// [JsonPropertyName("client")] - public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new Option(value); } } // d + public string VarClient { get { return this. VarClientOption; } set { this.VarClientOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override ModelClient Read(ref Utf8JsonReader utf8JsonReader, Type typeToC if (varClient.IsSet && varClient.Value == null) throw new ArgumentNullException(nameof(varClient), "Property is not nullable for class ModelClient."); - return new ModelClient(varClient); // a + return new ModelClient(varClient); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ModelClient modelClient, throw new ArgumentNullException(nameof(modelClient.VarClient), "Property is required for class ModelClient."); if (modelClient.VarClientOption.IsSet) - writer.WriteString("client", modelClient.VarClient); // 1 + writer.WriteString("client", modelClient.VarClient); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index 9280a4714418..0707bcfac9ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -52,43 +52,43 @@ public Name(int varName, Option property = default, Option snakeCa /// Gets or Sets VarName /// [JsonPropertyName("name")] - public int VarName { get; set; } // d + public int VarName { get; set; } /// /// Used to track the state of Property /// [JsonIgnore] - public Option PropertyOption { get; private set; } // option d + public Option PropertyOption { get; private set; } /// /// Gets or Sets Property /// [JsonPropertyName("property")] - public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new Option(value); } } // d + public string Property { get { return this. PropertyOption; } set { this.PropertyOption = new Option(value); } } /// /// Used to track the state of SnakeCase /// [JsonIgnore] - public Option SnakeCaseOption { get; } // option d + public Option SnakeCaseOption { get; } /// /// Gets or Sets SnakeCase /// [JsonPropertyName("snake_case")] - public int? SnakeCase { get { return this. SnakeCaseOption; } } // d + public int? SnakeCase { get { return this. SnakeCaseOption; } } /// /// Used to track the state of Var123Number /// [JsonIgnore] - public Option Var123NumberOption { get; } // option d + public Option Var123NumberOption { get; } /// /// Gets or Sets Var123Number /// [JsonPropertyName("123Number")] - public int? Var123Number { get { return this. Var123NumberOption; } } // d + public int? Var123Number { get { return this. Var123NumberOption; } } /// /// Gets or Sets additional properties @@ -243,7 +243,7 @@ public override Name Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (var123Number.IsSet && var123Number.Value == null) throw new ArgumentNullException(nameof(var123Number), "Property is not nullable for class Name."); - return new Name(varName.Value.Value, property, snakeCase, var123Number); // a + return new Name(varName.Value.Value, property, snakeCase, var123Number); } /// @@ -273,16 +273,16 @@ public void WriteProperties(ref Utf8JsonWriter writer, Name name, JsonSerializer if (name.PropertyOption.IsSet && name.Property == null) throw new ArgumentNullException(nameof(name.Property), "Property is required for class Name."); - writer.WriteNumber("name", name.VarName); // 3 + writer.WriteNumber("name", name.VarName); if (name.PropertyOption.IsSet) - writer.WriteString("property", name.Property); // 1 + writer.WriteString("property", name.Property); if (name.SnakeCaseOption.IsSet) - writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); // 3 + writer.WriteNumber("snake_case", name.SnakeCaseOption.Value.Value); if (name.Var123NumberOption.IsSet) - writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); // 3 + writer.WriteNumber("123Number", name.Var123NumberOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs index e91111bfa6af..cd1516104e35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NotificationtestGetElementsV1ResponseMPayload.cs @@ -48,13 +48,13 @@ public NotificationtestGetElementsV1ResponseMPayload(List [JsonPropertyName("a_objVariableobject")] - public List> AObjVariableobject { get; set; } // d + public List> AObjVariableobject { get; set; } /// /// Gets or Sets PkiNotificationtestID /// [JsonPropertyName("pkiNotificationtestID")] - public int PkiNotificationtestID { get; set; } // d + public int PkiNotificationtestID { get; set; } /// /// Gets or Sets additional properties @@ -154,7 +154,7 @@ public override NotificationtestGetElementsV1ResponseMPayload Read(ref Utf8JsonR if (pkiNotificationtestID.IsSet && pkiNotificationtestID.Value == null) throw new ArgumentNullException(nameof(pkiNotificationtestID), "Property is not nullable for class NotificationtestGetElementsV1ResponseMPayload."); - return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); // a + return new NotificationtestGetElementsV1ResponseMPayload(aObjVariableobject.Value, pkiNotificationtestID.Value.Value); } /// @@ -185,8 +185,8 @@ public void WriteProperties(ref Utf8JsonWriter writer, NotificationtestGetElemen throw new ArgumentNullException(nameof(notificationtestGetElementsV1ResponseMPayload.AObjVariableobject), "Property is required for class NotificationtestGetElementsV1ResponseMPayload."); writer.WritePropertyName("a_objVariableobject"); - JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); // 13 - writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); // 3 + JsonSerializer.Serialize(writer, notificationtestGetElementsV1ResponseMPayload.AObjVariableobject, jsonSerializerOptions); + writer.WriteNumber("pkiNotificationtestID", notificationtestGetElementsV1ResponseMPayload.PkiNotificationtestID); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 001b0385cbb0..361ef1167072 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -68,145 +68,145 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] - public Option> ArrayItemsNullableOption { get; private set; } // option d + public Option> ArrayItemsNullableOption { get; private set; } /// /// Gets or Sets ArrayItemsNullable /// [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new Option>(value); } } // d + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new Option>(value); } } /// /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] - public Option> ObjectItemsNullableOption { get; private set; } // option d + public Option> ObjectItemsNullableOption { get; private set; } /// /// Gets or Sets ObjectItemsNullable /// [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new Option>(value); } } // d + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new Option>(value); } } /// /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] - public Option> ArrayAndItemsNullablePropOption { get; private set; } // option d + public Option> ArrayAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ArrayAndItemsNullableProp /// [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new Option>(value); } } // d + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new Option>(value); } } /// /// Used to track the state of ArrayNullableProp /// [JsonIgnore] - public Option> ArrayNullablePropOption { get; private set; } // option d + public Option> ArrayNullablePropOption { get; private set; } /// /// Gets or Sets ArrayNullableProp /// [JsonPropertyName("array_nullable_prop")] - public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new Option>(value); } } // d + public List ArrayNullableProp { get { return this. ArrayNullablePropOption; } set { this.ArrayNullablePropOption = new Option>(value); } } /// /// Used to track the state of BooleanProp /// [JsonIgnore] - public Option BooleanPropOption { get; private set; } // option d + public Option BooleanPropOption { get; private set; } /// /// Gets or Sets BooleanProp /// [JsonPropertyName("boolean_prop")] - public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new Option(value); } } // d + public bool? BooleanProp { get { return this. BooleanPropOption; } set { this.BooleanPropOption = new Option(value); } } /// /// Used to track the state of DateProp /// [JsonIgnore] - public Option DatePropOption { get; private set; } // option d + public Option DatePropOption { get; private set; } /// /// Gets or Sets DateProp /// [JsonPropertyName("date_prop")] - public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new Option(value); } } // d + public DateTime? DateProp { get { return this. DatePropOption; } set { this.DatePropOption = new Option(value); } } /// /// Used to track the state of DatetimeProp /// [JsonIgnore] - public Option DatetimePropOption { get; private set; } // option d + public Option DatetimePropOption { get; private set; } /// /// Gets or Sets DatetimeProp /// [JsonPropertyName("datetime_prop")] - public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new Option(value); } } // d + public DateTime? DatetimeProp { get { return this. DatetimePropOption; } set { this.DatetimePropOption = new Option(value); } } /// /// Used to track the state of IntegerProp /// [JsonIgnore] - public Option IntegerPropOption { get; private set; } // option d + public Option IntegerPropOption { get; private set; } /// /// Gets or Sets IntegerProp /// [JsonPropertyName("integer_prop")] - public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new Option(value); } } // d + public int? IntegerProp { get { return this. IntegerPropOption; } set { this.IntegerPropOption = new Option(value); } } /// /// Used to track the state of NumberProp /// [JsonIgnore] - public Option NumberPropOption { get; private set; } // option d + public Option NumberPropOption { get; private set; } /// /// Gets or Sets NumberProp /// [JsonPropertyName("number_prop")] - public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new Option(value); } } // d + public decimal? NumberProp { get { return this. NumberPropOption; } set { this.NumberPropOption = new Option(value); } } /// /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] - public Option> ObjectAndItemsNullablePropOption { get; private set; } // option d + public Option> ObjectAndItemsNullablePropOption { get; private set; } /// /// Gets or Sets ObjectAndItemsNullableProp /// [JsonPropertyName("object_and_items_nullable_prop")] - public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new Option>(value); } } // d + public Dictionary ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new Option>(value); } } /// /// Used to track the state of ObjectNullableProp /// [JsonIgnore] - public Option> ObjectNullablePropOption { get; private set; } // option d + public Option> ObjectNullablePropOption { get; private set; } /// /// Gets or Sets ObjectNullableProp /// [JsonPropertyName("object_nullable_prop")] - public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new Option>(value); } } // d + public Dictionary ObjectNullableProp { get { return this. ObjectNullablePropOption; } set { this.ObjectNullablePropOption = new Option>(value); } } /// /// Used to track the state of StringProp /// [JsonIgnore] - public Option StringPropOption { get; private set; } // option d + public Option StringPropOption { get; private set; } /// /// Gets or Sets StringProp /// [JsonPropertyName("string_prop")] - public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new Option(value); } } // d + public string StringProp { get { return this. StringPropOption; } set { this.StringPropOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -380,7 +380,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); // a + return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); } /// @@ -413,13 +413,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) // 14 + if (nullableClass.ArrayItemsNullableOption.IsSet) writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - if (nullableClass.ObjectItemsNullableOption.IsSet) // 14 + if (nullableClass.ObjectItemsNullableOption.IsSet) writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("array_and_items_nullable_prop"); @@ -427,7 +427,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); - if (nullableClass.ArrayNullablePropOption.IsSet) // 14 + if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { writer.WritePropertyName("array_nullable_prop"); @@ -437,35 +437,35 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("array_nullable_prop"); if (nullableClass.BooleanPropOption.IsSet) if (nullableClass.BooleanPropOption.Value != null) - writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("boolean_prop", nullableClass.BooleanPropOption.Value.Value); else writer.WriteNull("boolean_prop"); if (nullableClass.DatePropOption.IsSet) if (nullableClass.DatePropOption.Value != null) - writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); // 4 + writer.WriteString("date_prop", nullableClass.DatePropOption.Value.Value.ToString(DatePropFormat)); else writer.WriteNull("date_prop"); if (nullableClass.DatetimePropOption.IsSet) if (nullableClass.DatetimePropOption.Value != null) - writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); // 5 + writer.WriteString("datetime_prop", nullableClass.DatetimePropOption.Value.Value.ToString(DatetimePropFormat)); else writer.WriteNull("datetime_prop"); if (nullableClass.IntegerPropOption.IsSet) if (nullableClass.IntegerPropOption.Value != null) - writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); // 3 + writer.WriteNumber("integer_prop", nullableClass.IntegerPropOption.Value.Value); else writer.WriteNull("integer_prop"); if (nullableClass.NumberPropOption.IsSet) if (nullableClass.NumberPropOption.Value != null) - writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); // 3 + writer.WriteNumber("number_prop", nullableClass.NumberPropOption.Value.Value); else writer.WriteNull("number_prop"); - if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectAndItemsNullablePropOption.IsSet) if (nullableClass.ObjectAndItemsNullablePropOption.Value != null) { writer.WritePropertyName("object_and_items_nullable_prop"); @@ -473,7 +473,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); - if (nullableClass.ObjectNullablePropOption.IsSet) // 14 + if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { writer.WritePropertyName("object_nullable_prop"); @@ -483,7 +483,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla writer.WriteNull("object_nullable_prop"); if (nullableClass.StringPropOption.IsSet) if (nullableClass.StringPropOption.Value != null) - writer.WriteString("string_prop", nullableClass.StringProp); // 1 + writer.WriteString("string_prop", nullableClass.StringProp); else writer.WriteNull("string_prop"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 2bb4129d90a6..a46e93b03b7d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -46,14 +46,14 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("uuid")] - public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d + public Guid? Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -135,7 +135,7 @@ public override NullableGuidClass Read(ref Utf8JsonReader utf8JsonReader, Type t } } - return new NullableGuidClass(uuid); // a + return new NullableGuidClass(uuid); } /// @@ -164,7 +164,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableGuidClass nullabl { if (nullableGuidClass.UuidOption.IsSet) if (nullableGuidClass.UuidOption.Value != null) - writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); // 11 + writer.WriteString("uuid", nullableGuidClass.UuidOption.Value.Value); else writer.WriteNull("uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs index de01979e880b..1e38640c8af9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableShape.cs @@ -69,7 +69,7 @@ public NullableShape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override NullableShape Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class NullableShape."); if (quadrilateral != null) - return new NullableShape(quadrilateral, shapeType.Value); // c + return new NullableShape(quadrilateral, shapeType.Value); if (triangle != null) - return new NullableShape(triangle, shapeType.Value); // c + return new NullableShape(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableShape nullableSha if (nullableShape.ShapeType == null) throw new ArgumentNullException(nameof(nullableShape.ShapeType), "Property is required for class NullableShape."); - writer.WriteString("shapeType", nullableShape.ShapeType); // 1 + writer.WriteString("shapeType", nullableShape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 89fd93376675..d816d1cf8a01 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -46,13 +46,13 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] - public Option JustNumberOption { get; private set; } // option d + public Option JustNumberOption { get; private set; } /// /// Gets or Sets JustNumber /// [JsonPropertyName("JustNumber")] - public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new Option(value); } } // d + public decimal? JustNumber { get { return this. JustNumberOption; } set { this.JustNumberOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override NumberOnly Read(ref Utf8JsonReader utf8JsonReader, Type typeToCo if (justNumber.IsSet && justNumber.Value == null) throw new ArgumentNullException(nameof(justNumber), "Property is not nullable for class NumberOnly."); - return new NumberOnly(justNumber); // a + return new NumberOnly(justNumber); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, NumberOnly numberOnly, JsonSer public void WriteProperties(ref Utf8JsonWriter writer, NumberOnly numberOnly, JsonSerializerOptions jsonSerializerOptions) { if (numberOnly.JustNumberOption.IsSet) - writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); // 3 + writer.WriteNumber("JustNumber", numberOnly.JustNumberOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index ea61607836b8..1190c9cd6457 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -52,52 +52,52 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] - public Option> BarsOption { get; private set; } // option d + public Option> BarsOption { get; private set; } /// /// Gets or Sets Bars /// [JsonPropertyName("bars")] [Obsolete] - public List Bars { get { return this. BarsOption; } set { this.BarsOption = new Option>(value); } } // d + public List Bars { get { return this. BarsOption; } set { this.BarsOption = new Option>(value); } } /// /// Used to track the state of DeprecatedRef /// [JsonIgnore] - public Option DeprecatedRefOption { get; private set; } // option d + public Option DeprecatedRefOption { get; private set; } /// /// Gets or Sets DeprecatedRef /// [JsonPropertyName("deprecatedRef")] [Obsolete] - public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new Option(value); } } // d + public DeprecatedObject DeprecatedRef { get { return this. DeprecatedRefOption; } set { this.DeprecatedRefOption = new Option(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] [Obsolete] - public decimal? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public decimal? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Used to track the state of Uuid /// [JsonIgnore] - public Option UuidOption { get; private set; } // option d + public Option UuidOption { get; private set; } /// /// Gets or Sets Uuid /// [JsonPropertyName("uuid")] - public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } // d + public string Uuid { get { return this. UuidOption; } set { this.UuidOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -208,7 +208,7 @@ public override ObjectWithDeprecatedFields Read(ref Utf8JsonReader utf8JsonReade if (uuid.IsSet && uuid.Value == null) throw new ArgumentNullException(nameof(uuid), "Property is not nullable for class ObjectWithDeprecatedFields."); - return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); // a + return new ObjectWithDeprecatedFields(bars, deprecatedRef, id, uuid); } /// @@ -244,17 +244,17 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField if (objectWithDeprecatedFields.UuidOption.IsSet && objectWithDeprecatedFields.Uuid == null) throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); - if (objectWithDeprecatedFields.BarsOption.IsSet) // 14 + if (objectWithDeprecatedFields.BarsOption.IsSet) writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); - if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) // 14 + if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); if (objectWithDeprecatedFields.IdOption.IsSet) - writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); // 3 + writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); if (objectWithDeprecatedFields.UuidOption.IsSet) - writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); // 1 + writer.WriteString("uuid", objectWithDeprecatedFields.Uuid); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs index 99d1c17f0843..660604e3ef17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OneOfString.cs @@ -122,10 +122,10 @@ public override OneOfString Read(ref Utf8JsonReader utf8JsonReader, Type typeToC } if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); if (varString != null) - return new OneOfString(varString); // b + return new OneOfString(varString); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index f0380c6d7930..1a9114eac536 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -137,75 +137,75 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// Order Status /// /// Order Status [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Used to track the state of PetId /// [JsonIgnore] - public Option PetIdOption { get; private set; } // option d + public Option PetIdOption { get; private set; } /// /// Gets or Sets PetId /// [JsonPropertyName("petId")] - public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new Option(value); } } // d + public long? PetId { get { return this. PetIdOption; } set { this.PetIdOption = new Option(value); } } /// /// Used to track the state of Quantity /// [JsonIgnore] - public Option QuantityOption { get; private set; } // option d + public Option QuantityOption { get; private set; } /// /// Gets or Sets Quantity /// [JsonPropertyName("quantity")] - public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new Option(value); } } // d + public int? Quantity { get { return this. QuantityOption; } set { this.QuantityOption = new Option(value); } } /// /// Used to track the state of ShipDate /// [JsonIgnore] - public Option ShipDateOption { get; private set; } // option d + public Option ShipDateOption { get; private set; } /// /// Gets or Sets ShipDate /// /// 2020-02-02T20:20:20.000222Z [JsonPropertyName("shipDate")] - public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new Option(value); } } // d + public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new Option(value); } } /// /// Used to track the state of Complete /// [JsonIgnore] - public Option CompleteOption { get; private set; } // option d + public Option CompleteOption { get; private set; } /// /// Gets or Sets Complete /// [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new Option(value); } } // d + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -341,7 +341,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (complete.IsSet && complete.Value == null) throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - return new Order(id, petId, quantity, shipDate, status, complete); // a + return new Order(id, petId, quantity, shipDate, status, complete); } /// @@ -369,25 +369,25 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { if (order.IdOption.IsSet) - writer.WriteNumber("id", order.IdOption.Value.Value); // 3 + writer.WriteNumber("id", order.IdOption.Value.Value); if (order.PetIdOption.IsSet) - writer.WriteNumber("petId", order.PetIdOption.Value.Value); // 3 + writer.WriteNumber("petId", order.PetIdOption.Value.Value); if (order.QuantityOption.IsSet) - writer.WriteNumber("quantity", order.QuantityOption.Value.Value); // 3 + writer.WriteNumber("quantity", order.QuantityOption.Value.Value); if (order.ShipDateOption.IsSet) - writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); // 5 + writer.WriteString("shipDate", order.ShipDateOption.Value.Value.ToString(ShipDateFormat)); - var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); // 7 + var statusRawValue = Order.StatusEnumToJsonValue(order.StatusOption.Value.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value.Value); // 2 + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 5dac340991b8..6f38c4ff6fdc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -50,37 +50,37 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] - public Option MyBooleanOption { get; private set; } // option d + public Option MyBooleanOption { get; private set; } /// /// Gets or Sets MyBoolean /// [JsonPropertyName("my_boolean")] - public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new Option(value); } } // d + public bool? MyBoolean { get { return this. MyBooleanOption; } set { this.MyBooleanOption = new Option(value); } } /// /// Used to track the state of MyNumber /// [JsonIgnore] - public Option MyNumberOption { get; private set; } // option d + public Option MyNumberOption { get; private set; } /// /// Gets or Sets MyNumber /// [JsonPropertyName("my_number")] - public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new Option(value); } } // d + public decimal? MyNumber { get { return this. MyNumberOption; } set { this.MyNumberOption = new Option(value); } } /// /// Used to track the state of MyString /// [JsonIgnore] - public Option MyStringOption { get; private set; } // option d + public Option MyStringOption { get; private set; } /// /// Gets or Sets MyString /// [JsonPropertyName("my_string")] - public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new Option(value); } } // d + public string MyString { get { return this. MyStringOption; } set { this.MyStringOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -182,7 +182,7 @@ public override OuterComposite Read(ref Utf8JsonReader utf8JsonReader, Type type if (myString.IsSet && myString.Value == null) throw new ArgumentNullException(nameof(myString), "Property is not nullable for class OuterComposite."); - return new OuterComposite(myBoolean, myNumber, myString); // a + return new OuterComposite(myBoolean, myNumber, myString); } /// @@ -213,13 +213,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, OuterComposite outerCompo throw new ArgumentNullException(nameof(outerComposite.MyString), "Property is required for class OuterComposite."); if (outerComposite.MyBooleanOption.IsSet) - writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); // 2 + writer.WriteBoolean("my_boolean", outerComposite.MyBooleanOption.Value.Value); if (outerComposite.MyNumberOption.IsSet) - writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); // 3 + writer.WriteNumber("my_number", outerComposite.MyNumberOption.Value.Value); if (outerComposite.MyStringOption.IsSet) - writer.WriteString("my_string", outerComposite.MyString); // 1 + writer.WriteString("my_string", outerComposite.MyString); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs index 9c292f10c059..c451e1a8991b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ParentPet.cs @@ -109,7 +109,7 @@ public override ParentPet Read(ref Utf8JsonReader utf8JsonReader, Type typeToCon if (petType.IsSet && petType.Value == null) throw new ArgumentNullException(nameof(petType), "Property is not nullable for class ParentPet."); - return new ParentPet(petType.Value); // a + return new ParentPet(petType.Value); } /// @@ -139,7 +139,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ParentPet parentPet, Json if (parentPet.PetType == null) throw new ArgumentNullException(nameof(parentPet.PetType), "Property is required for class ParentPet."); - writer.WriteString("pet_type", parentPet.PetType); // 1 + writer.WriteString("pet_type", parentPet.PetType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index bb1eb881038a..57e4765357ec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -137,63 +137,63 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] - public Option StatusOption { get; private set; } // option a + public Option StatusOption { get; private set; } /// /// pet status in the store /// /// pet status in the store [JsonPropertyName("status")] - public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } // a + public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } /// /// Gets or Sets Name /// /// doggie [JsonPropertyName("name")] - public string Name { get; set; } // d + public string Name { get; set; } /// /// Gets or Sets PhotoUrls /// [JsonPropertyName("photoUrls")] - public List PhotoUrls { get; set; } // d + public List PhotoUrls { get; set; } /// /// Used to track the state of Category /// [JsonIgnore] - public Option CategoryOption { get; private set; } // option d + public Option CategoryOption { get; private set; } /// /// Gets or Sets Category /// [JsonPropertyName("category")] - public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new Option(value); } } // d + public Category Category { get { return this. CategoryOption; } set { this.CategoryOption = new Option(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Used to track the state of Tags /// [JsonIgnore] - public Option> TagsOption { get; private set; } // option d + public Option> TagsOption { get; private set; } /// /// Gets or Sets Tags /// [JsonPropertyName("tags")] - public List Tags { get { return this. TagsOption; } set { this.TagsOption = new Option>(value); } } // d + public List Tags { get { return this. TagsOption; } set { this.TagsOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -329,7 +329,7 @@ public override Pet Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (tags.IsSet && tags.Value == null) throw new ArgumentNullException(nameof(tags), "Property is not nullable for class Pet."); - return new Pet(name.Value, photoUrls.Value, category, id, status, tags); // a + return new Pet(name.Value, photoUrls.Value, category, id, status, tags); } /// @@ -368,23 +368,23 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp if (pet.TagsOption.IsSet && pet.Tags == null) throw new ArgumentNullException(nameof(pet.Tags), "Property is required for class Pet."); - writer.WriteString("name", pet.Name); // 1 + writer.WriteString("name", pet.Name); writer.WritePropertyName("photoUrls"); - JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); // 13 - if (pet.CategoryOption.IsSet) // 14 + JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); + if (pet.CategoryOption.IsSet) writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); if (pet.IdOption.IsSet) - writer.WriteNumber("id", pet.IdOption.Value.Value); // 3 + writer.WriteNumber("id", pet.IdOption.Value.Value); - var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); // 7 + var statusRawValue = Pet.StatusEnumToJsonValue(pet.StatusOption.Value.Value); if (statusRawValue != null) writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - if (pet.TagsOption.IsSet) // 14 + if (pet.TagsOption.IsSet) writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs index f1eb3e0e3145..d3bbeb8ff326 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pig.cs @@ -69,7 +69,7 @@ public Pig(DanishPig danishPig, string className) /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Pig Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, throw new ArgumentNullException(nameof(className), "Property is not nullable for class Pig."); if (basquePig != null) - return new Pig(basquePig, className.Value); // c + return new Pig(basquePig, className.Value); if (danishPig != null) - return new Pig(danishPig, className.Value); // c + return new Pig(danishPig, className.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pig pig, JsonSerializerOp if (pig.ClassName == null) throw new ArgumentNullException(nameof(pig.ClassName), "Property is required for class Pig."); - writer.WriteString("className", pig.ClassName); // 1 + writer.WriteString("className", pig.ClassName); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs index 78791de532b9..2c2227a22512 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/PolymorphicProperty.cs @@ -195,16 +195,16 @@ public override PolymorphicProperty Read(ref Utf8JsonReader utf8JsonReader, Type } if (varBool != null) - return new PolymorphicProperty(varBool); // b + return new PolymorphicProperty(varBool); if (varString != null) - return new PolymorphicProperty(varString); // b + return new PolymorphicProperty(varString); if (varObject != null) - return new PolymorphicProperty(varObject); // b + return new PolymorphicProperty(varObject); if (list != null) - return new PolymorphicProperty(list); // b + return new PolymorphicProperty(list); throw new JsonException(); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs index 2c238cd4ce3a..3f4034a17713 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Quadrilateral.cs @@ -69,7 +69,7 @@ public Quadrilateral(ComplexQuadrilateral complexQuadrilateral, string quadrilat /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Quadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type typeT throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class Quadrilateral."); if (complexQuadrilateral != null) - return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); // c + return new Quadrilateral(complexQuadrilateral, quadrilateralType.Value); if (simpleQuadrilateral != null) - return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); // c + return new Quadrilateral(simpleQuadrilateral, quadrilateralType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Quadrilateral quadrilater if (quadrilateral.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateral.QuadrilateralType), "Property is required for class Quadrilateral."); - writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateral.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs index 69c52bc4bafc..75b7e516cfca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/QuadrilateralInterface.cs @@ -46,7 +46,7 @@ public QuadrilateralInterface(string quadrilateralType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override QuadrilateralInterface Read(ref Utf8JsonReader utf8JsonReader, T if (quadrilateralType.IsSet && quadrilateralType.Value == null) throw new ArgumentNullException(nameof(quadrilateralType), "Property is not nullable for class QuadrilateralInterface."); - return new QuadrilateralInterface(quadrilateralType.Value); // a + return new QuadrilateralInterface(quadrilateralType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, QuadrilateralInterface qu if (quadrilateralInterface.QuadrilateralType == null) throw new ArgumentNullException(nameof(quadrilateralInterface.QuadrilateralType), "Property is required for class QuadrilateralInterface."); - writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", quadrilateralInterface.QuadrilateralType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index bf0449857edb..baba059e050d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -48,25 +48,25 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Bar /// [JsonIgnore] - public Option BarOption { get; } // option d + public Option BarOption { get; } /// /// Gets or Sets Bar /// [JsonPropertyName("bar")] - public string Bar { get { return this. BarOption; } } // d + public string Bar { get { return this. BarOption; } } /// /// Used to track the state of Baz /// [JsonIgnore] - public Option BazOption { get; private set; } // option d + public Option BazOption { get; private set; } /// /// Gets or Sets Baz /// [JsonPropertyName("baz")] - public string Baz { get { return this. BazOption; } set { this.BazOption = new Option(value); } } // d + public string Baz { get { return this. BazOption; } set { this.BazOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -196,7 +196,7 @@ public override ReadOnlyFirst Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (baz.IsSet && baz.Value == null) throw new ArgumentNullException(nameof(baz), "Property is not nullable for class ReadOnlyFirst."); - return new ReadOnlyFirst(bar, baz); // a + return new ReadOnlyFirst(bar, baz); } /// @@ -230,10 +230,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ReadOnlyFirst readOnlyFir throw new ArgumentNullException(nameof(readOnlyFirst.Baz), "Property is required for class ReadOnlyFirst."); if (readOnlyFirst.BarOption.IsSet) - writer.WriteString("bar", readOnlyFirst.Bar); // 1 + writer.WriteString("bar", readOnlyFirst.Bar); if (readOnlyFirst.BazOption.IsSet) - writer.WriteString("baz", readOnlyFirst.Baz); // 1 + writer.WriteString("baz", readOnlyFirst.Baz); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 143ba25a1d13..b639708f815e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -191,7 +191,7 @@ public static int RequiredNotnullableEnumIntegerEnumToJsonValue(RequiredNotnulla /// Gets or Sets RequiredNotnullableEnumInteger /// [JsonPropertyName("required_notnullable_enum_integer")] - public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } // a + public RequiredNotnullableEnumIntegerEnum RequiredNotnullableEnumInteger { get; set; } /// /// Defines RequiredNotnullableEnumIntegerOnly @@ -256,7 +256,7 @@ public static int RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(RequiredNotn /// Gets or Sets RequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("required_notnullable_enum_integer_only")] - public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } // a + public RequiredNotnullableEnumIntegerOnlyEnum RequiredNotnullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNotnullableEnumString @@ -412,13 +412,13 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul /// Gets or Sets RequiredNotnullableEnumString /// [JsonPropertyName("required_notnullable_enum_string")] - public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } // a + public RequiredNotnullableEnumStringEnum RequiredNotnullableEnumString { get; set; } /// /// Gets or Sets RequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("required_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNotnullableEnumInteger @@ -483,13 +483,13 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumInteger /// [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new Option(value); } } // a + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new Option(value); } } /// /// Defines NotrequiredNotnullableEnumIntegerOnly @@ -554,13 +554,13 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new Option(value); } } // a + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new Option(value); } } /// /// Defines NotrequiredNotnullableEnumString @@ -716,25 +716,25 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableEnumString /// [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new Option(value); } } // a + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new Option(value); } } /// /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new Option(value); } } // a + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new Option(value); } } /// /// Defines RequiredNullableEnumInteger @@ -799,7 +799,7 @@ public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnu /// Gets or Sets RequiredNullableEnumInteger /// [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } // a + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// /// Defines RequiredNullableEnumIntegerOnly @@ -864,7 +864,7 @@ public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullabl /// Gets or Sets RequiredNullableEnumIntegerOnly /// [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } // a + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// /// Defines RequiredNullableEnumString @@ -1023,13 +1023,13 @@ public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableE /// Gets or Sets RequiredNullableEnumString /// [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } // a + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } // a + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// /// Defines NotrequiredNullableEnumInteger @@ -1094,13 +1094,13 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumInteger /// [JsonPropertyName("notrequired_nullable_enum_integer")] - public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new Option(value); } } // a + public NotrequiredNullableEnumIntegerEnum? NotrequiredNullableEnumInteger { get { return this.NotrequiredNullableEnumIntegerOption; } set { this.NotrequiredNullableEnumIntegerOption = new Option(value); } } /// /// Defines NotrequiredNullableEnumIntegerOnly @@ -1165,13 +1165,13 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] - public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } // option a + public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumIntegerOnly /// [JsonPropertyName("notrequired_nullable_enum_integer_only")] - public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new Option(value); } } // a + public NotrequiredNullableEnumIntegerOnlyEnum? NotrequiredNullableEnumIntegerOnly { get { return this.NotrequiredNullableEnumIntegerOnlyOption; } set { this.NotrequiredNullableEnumIntegerOnlyOption = new Option(value); } } /// /// Defines NotrequiredNullableEnumString @@ -1330,281 +1330,281 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] - public Option NotrequiredNullableEnumStringOption { get; private set; } // option a + public Option NotrequiredNullableEnumStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableEnumString /// [JsonPropertyName("notrequired_nullable_enum_string")] - public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new Option(value); } } // a + public NotrequiredNullableEnumStringEnum? NotrequiredNullableEnumString { get { return this.NotrequiredNullableEnumStringOption; } set { this.NotrequiredNullableEnumStringOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] - public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } // option a + public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// /// Gets or Sets NotrequiredNullableOuterEnumDefaultValue /// [JsonPropertyName("notrequired_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new Option(value); } } // a + public OuterEnumDefaultValue? NotrequiredNullableOuterEnumDefaultValue { get { return this.NotrequiredNullableOuterEnumDefaultValueOption; } set { this.NotrequiredNullableOuterEnumDefaultValueOption = new Option(value); } } /// /// Gets or Sets RequiredNotNullableDateProp /// [JsonPropertyName("required_not_nullable_date_prop")] - public DateTime RequiredNotNullableDateProp { get; set; } // d + public DateTime RequiredNotNullableDateProp { get; set; } /// /// Gets or Sets RequiredNotnullableArrayOfString /// [JsonPropertyName("required_notnullable_array_of_string")] - public List RequiredNotnullableArrayOfString { get; set; } // d + public List RequiredNotnullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNotnullableBooleanProp /// [JsonPropertyName("required_notnullable_boolean_prop")] - public bool RequiredNotnullableBooleanProp { get; set; } // d + public bool RequiredNotnullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNotnullableDatetimeProp /// [JsonPropertyName("required_notnullable_datetime_prop")] - public DateTime RequiredNotnullableDatetimeProp { get; set; } // d + public DateTime RequiredNotnullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNotnullableStringProp /// [JsonPropertyName("required_notnullable_string_prop")] - public string RequiredNotnullableStringProp { get; set; } // d + public string RequiredNotnullableStringProp { get; set; } /// /// Gets or Sets RequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_notnullable_uuid")] - public Guid RequiredNotnullableUuid { get; set; } // d + public Guid RequiredNotnullableUuid { get; set; } /// /// Gets or Sets RequiredNotnullableintegerProp /// [JsonPropertyName("required_notnullableinteger_prop")] - public int RequiredNotnullableintegerProp { get; set; } // d + public int RequiredNotnullableintegerProp { get; set; } /// /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] - public Option NotRequiredNotnullableDatePropOption { get; private set; } // option d + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableDateProp /// [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new Option(value); } } // d + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new Option(value); } } /// /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } // option d + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNotnullableintegerProp /// [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new Option(value); } } // d + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] - public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } // option d + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableArrayOfString /// [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new Option>(value); } } // d + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new Option>(value); } } /// /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableBooleanProp /// [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new Option(value); } } // d + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableDatetimeProp /// [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new Option(value); } } // d + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] - public Option NotrequiredNotnullableStringPropOption { get; private set; } // option d + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableStringProp /// [JsonPropertyName("notrequired_notnullable_string_prop")] - public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new Option(value); } } // d + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] - public Option NotrequiredNotnullableUuidOption { get; private set; } // option d + public Option NotrequiredNotnullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNotnullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option(value); } } // d + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option(value); } } /// /// Gets or Sets RequiredNullableArrayOfString /// [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } // d + public List RequiredNullableArrayOfString { get; set; } /// /// Gets or Sets RequiredNullableBooleanProp /// [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } // d + public bool? RequiredNullableBooleanProp { get; set; } /// /// Gets or Sets RequiredNullableDateProp /// [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } // d + public DateTime? RequiredNullableDateProp { get; set; } /// /// Gets or Sets RequiredNullableDatetimeProp /// [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } // d + public DateTime? RequiredNullableDatetimeProp { get; set; } /// /// Gets or Sets RequiredNullableIntegerProp /// [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } // d + public int? RequiredNullableIntegerProp { get; set; } /// /// Gets or Sets RequiredNullableStringProp /// [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } // d + public string RequiredNullableStringProp { get; set; } /// /// Gets or Sets RequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } // d + public Guid? RequiredNullableUuid { get; set; } /// /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] - public Option NotRequiredNullableDatePropOption { get; private set; } // option d + public Option NotRequiredNullableDatePropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableDateProp /// [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new Option(value); } } // d + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new Option(value); } } /// /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] - public Option NotRequiredNullableIntegerPropOption { get; private set; } // option d + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// /// Gets or Sets NotRequiredNullableIntegerProp /// [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new Option(value); } } // d + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] - public Option> NotrequiredNullableArrayOfStringOption { get; private set; } // option d + public Option> NotrequiredNullableArrayOfStringOption { get; private set; } /// /// Gets or Sets NotrequiredNullableArrayOfString /// [JsonPropertyName("notrequired_nullable_array_of_string")] - public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new Option>(value); } } // d + public List NotrequiredNullableArrayOfString { get { return this. NotrequiredNullableArrayOfStringOption; } set { this.NotrequiredNullableArrayOfStringOption = new Option>(value); } } /// /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] - public Option NotrequiredNullableBooleanPropOption { get; private set; } // option d + public Option NotrequiredNullableBooleanPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableBooleanProp /// [JsonPropertyName("notrequired_nullable_boolean_prop")] - public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new Option(value); } } // d + public bool? NotrequiredNullableBooleanProp { get { return this. NotrequiredNullableBooleanPropOption; } set { this.NotrequiredNullableBooleanPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] - public Option NotrequiredNullableDatetimePropOption { get; private set; } // option d + public Option NotrequiredNullableDatetimePropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableDatetimeProp /// [JsonPropertyName("notrequired_nullable_datetime_prop")] - public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new Option(value); } } // d + public DateTime? NotrequiredNullableDatetimeProp { get { return this. NotrequiredNullableDatetimePropOption; } set { this.NotrequiredNullableDatetimePropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] - public Option NotrequiredNullableStringPropOption { get; private set; } // option d + public Option NotrequiredNullableStringPropOption { get; private set; } /// /// Gets or Sets NotrequiredNullableStringProp /// [JsonPropertyName("notrequired_nullable_string_prop")] - public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new Option(value); } } // d + public string NotrequiredNullableStringProp { get { return this. NotrequiredNullableStringPropOption; } set { this.NotrequiredNullableStringPropOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] - public Option NotrequiredNullableUuidOption { get; private set; } // option d + public Option NotrequiredNullableUuidOption { get; private set; } /// /// Gets or Sets NotrequiredNullableUuid /// /// 72f98069-206d-4f12-9f12-3d1e525a8e84 [JsonPropertyName("notrequired_nullable_uuid")] - public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new Option(value); } } // d + public Guid? NotrequiredNullableUuid { get { return this. NotrequiredNullableUuidOption; } set { this.NotrequiredNullableUuidOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -2120,7 +2120,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); // a + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2159,72 +2159,72 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet && requiredClass.NotrequiredNotnullableStringProp == null) throw new ArgumentNullException(nameof(requiredClass.NotrequiredNotnullableStringProp), "Property is required for class RequiredClass."); - writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); // 4 + writer.WriteString("required_not_nullable_date_prop", requiredClass.RequiredNotNullableDateProp.ToString(RequiredNotNullableDatePropFormat)); writer.WritePropertyName("required_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); // 13 - writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); // 2 + JsonSerializer.Serialize(writer, requiredClass.RequiredNotnullableArrayOfString, jsonSerializerOptions); + writer.WriteBoolean("required_notnullable_boolean_prop", requiredClass.RequiredNotnullableBooleanProp); - writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("required_notnullable_datetime_prop", requiredClass.RequiredNotnullableDatetimeProp.ToString(RequiredNotnullableDatetimePropFormat)); - writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); // 6 + writer.WriteNumber("required_notnullable_enum_integer", RequiredClass.RequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNotnullableEnumInteger)); - writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); // 6 + writer.WriteNumber("required_notnullable_enum_integer_only", RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNotnullableEnumIntegerOnly)); - var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); // 7 + var requiredNotnullableEnumStringRawValue = RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClass.RequiredNotnullableEnumString); if (requiredNotnullableEnumStringRawValue != null) writer.WriteString("required_notnullable_enum_string", requiredNotnullableEnumStringRawValue); else writer.WriteNull("required_notnullable_enum_string"); - var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); // 9 + var requiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNotnullableOuterEnumDefaultValue); writer.WriteString("required_notnullable_outerEnumDefaultValue", requiredNotnullableOuterEnumDefaultValueRawValue); - writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); // 1 + writer.WriteString("required_notnullable_string_prop", requiredClass.RequiredNotnullableStringProp); - writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); // 11 + writer.WriteString("required_notnullable_uuid", requiredClass.RequiredNotnullableUuid); - writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); // 3 + writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); // 4 + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); // 3 + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); // 7 + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); if (notrequiredNotnullableEnumStringRawValue != null) writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); else writer.WriteNull("notrequired_notnullable_enum_string"); - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) // 10 + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); // 10 b + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); } if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); // 1 + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); // 11 + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); - if (requiredClass.RequiredNullableArrayOfString != null) // 12 + if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.RequiredNullableArrayOfString, jsonSerializerOptions); @@ -2232,46 +2232,46 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_array_of_string"); if (requiredClass.RequiredNullableBooleanProp != null) - writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); // 2 + writer.WriteBoolean("required_nullable_boolean_prop", requiredClass.RequiredNullableBooleanProp.Value); else writer.WriteNull("required_nullable_boolean_prop"); if (requiredClass.RequiredNullableDateProp != null) - writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); // 4 + writer.WriteString("required_nullable_date_prop", requiredClass.RequiredNullableDateProp.Value.ToString(RequiredNullableDatePropFormat)); else writer.WriteNull("required_nullable_date_prop"); if (requiredClass.RequiredNullableDatetimeProp != null) - writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("required_nullable_datetime_prop", requiredClass.RequiredNullableDatetimeProp.Value.ToString(RequiredNullableDatetimePropFormat)); else writer.WriteNull("required_nullable_datetime_prop"); if (requiredClass.RequiredNullableEnumInteger != null) - writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer", RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClass.RequiredNullableEnumInteger.Value)); else writer.WriteNull("required_nullable_enum_integer"); if (requiredClass.RequiredNullableEnumIntegerOnly != null) - writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); // 6 + writer.WriteNumber("required_nullable_enum_integer_only", RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.RequiredNullableEnumIntegerOnly.Value)); else writer.WriteNull("required_nullable_enum_integer_only"); - var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); // 7 + var requiredNullableEnumStringRawValue = RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClass.RequiredNullableEnumString.Value); if (requiredNullableEnumStringRawValue != null) writer.WriteString("required_nullable_enum_string", requiredNullableEnumStringRawValue); else writer.WriteNull("required_nullable_enum_string"); if (requiredClass.RequiredNullableIntegerProp != null) - writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); // 3 + writer.WriteNumber("required_nullable_integer_prop", requiredClass.RequiredNullableIntegerProp.Value); else writer.WriteNull("required_nullable_integer_prop"); - if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) // 8 + if (requiredClass.RequiredNullableOuterEnumDefaultValue == null) writer.WriteNull("required_nullable_outerEnumDefaultValue"); else { - var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); // 8a + var requiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.RequiredNullableOuterEnumDefaultValue.Value); if (requiredNullableOuterEnumDefaultValueRawValue != null) writer.WriteString("required_nullable_outerEnumDefaultValue", requiredNullableOuterEnumDefaultValueRawValue); else @@ -2279,28 +2279,28 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla } if (requiredClass.RequiredNullableStringProp != null) - writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); // 1 + writer.WriteString("required_nullable_string_prop", requiredClass.RequiredNullableStringProp); else writer.WriteNull("required_nullable_string_prop"); if (requiredClass.RequiredNullableUuid != null) - writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); // 11 + writer.WriteString("required_nullable_uuid", requiredClass.RequiredNullableUuid.Value); else writer.WriteNull("required_nullable_uuid"); if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) - writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); // 4 + writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); else writer.WriteNull("not_required_nullable_date_prop"); if (requiredClass.NotRequiredNullableIntegerPropOption.IsSet) if (requiredClass.NotRequiredNullableIntegerPropOption.Value != null) - writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); // 3 + writer.WriteNumber("not_required_nullable_integer_prop", requiredClass.NotRequiredNullableIntegerPropOption.Value.Value); else writer.WriteNull("not_required_nullable_integer_prop"); - if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) // 14 + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { writer.WritePropertyName("notrequired_nullable_array_of_string"); @@ -2310,51 +2310,51 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNull("notrequired_nullable_array_of_string"); if (requiredClass.NotrequiredNullableBooleanPropOption.IsSet) if (requiredClass.NotrequiredNullableBooleanPropOption.Value != null) - writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); // 2 + writer.WriteBoolean("notrequired_nullable_boolean_prop", requiredClass.NotrequiredNullableBooleanPropOption.Value.Value); else writer.WriteNull("notrequired_nullable_boolean_prop"); if (requiredClass.NotrequiredNullableDatetimePropOption.IsSet) if (requiredClass.NotrequiredNullableDatetimePropOption.Value != null) - writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); // 5 + writer.WriteString("notrequired_nullable_datetime_prop", requiredClass.NotrequiredNullableDatetimePropOption.Value.Value.ToString(NotrequiredNullableDatetimePropFormat)); else writer.WriteNull("notrequired_nullable_datetime_prop"); if (requiredClass.NotrequiredNullableEnumIntegerOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer", RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOption.Value.Value)); else writer.WriteNull("notrequired_nullable_enum_integer"); if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.IsSet) if (requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value != null) - writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); // 6 + writer.WriteNumber("notrequired_nullable_enum_integer_only", RequiredClass.NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNullableEnumIntegerOnlyOption.Value.Value)); else writer.WriteNull("notrequired_nullable_enum_integer_only"); - var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); // 7 + var notrequiredNullableEnumStringRawValue = RequiredClass.NotrequiredNullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNullableEnumStringOption.Value.Value); if (notrequiredNullableEnumStringRawValue != null) writer.WriteString("notrequired_nullable_enum_string", notrequiredNullableEnumStringRawValue); else writer.WriteNull("notrequired_nullable_enum_string"); - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) // 10 - if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) // 10 a + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.IsSet) + if (requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value != null) { - var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); // 10 c + var notrequiredNullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNullableOuterEnumDefaultValueOption.Value.Value); writer.WriteString("notrequired_nullable_outerEnumDefaultValue", notrequiredNullableOuterEnumDefaultValueRawValue); } else writer.WriteNull("notrequired_nullable_outerEnumDefaultValue"); if (requiredClass.NotrequiredNullableStringPropOption.IsSet) if (requiredClass.NotrequiredNullableStringPropOption.Value != null) - writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); // 1 + writer.WriteString("notrequired_nullable_string_prop", requiredClass.NotrequiredNullableStringProp); else writer.WriteNull("notrequired_nullable_string_prop"); if (requiredClass.NotrequiredNullableUuidOption.IsSet) if (requiredClass.NotrequiredNullableUuidOption.Value != null) - writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); // 11 + writer.WriteString("notrequired_nullable_uuid", requiredClass.NotrequiredNullableUuidOption.Value.Value); else writer.WriteNull("notrequired_nullable_uuid"); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs index 3170fc7d3c1a..4ee1dfd83a2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs @@ -46,13 +46,13 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] - public Option VarReturnOption { get; private set; } // option d + public Option VarReturnOption { get; private set; } /// /// Gets or Sets VarReturn /// [JsonPropertyName("return")] - public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new Option(value); } } // d + public int? VarReturn { get { return this. VarReturnOption; } set { this.VarReturnOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override Return Read(ref Utf8JsonReader utf8JsonReader, Type typeToConver if (varReturn.IsSet && varReturn.Value == null) throw new ArgumentNullException(nameof(varReturn), "Property is not nullable for class Return."); - return new Return(varReturn); // a + return new Return(varReturn); } /// @@ -165,7 +165,7 @@ public override void Write(Utf8JsonWriter writer, Return varReturn, JsonSerializ public void WriteProperties(ref Utf8JsonWriter writer, Return varReturn, JsonSerializerOptions jsonSerializerOptions) { if (varReturn.VarReturnOption.IsSet) - writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); // 3 + writer.WriteNumber("return", varReturn.VarReturnOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index c219f6f39913..6063f8c719d4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -48,25 +48,25 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] - public Option RoleOption { get; private set; } // option d + public Option RoleOption { get; private set; } /// /// Gets or Sets Role /// [JsonPropertyName("role")] - public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new Option(value); } } // d + public RolesReportsHashRole Role { get { return this. RoleOption; } set { this.RoleOption = new Option(value); } } /// /// Used to track the state of RoleUuid /// [JsonIgnore] - public Option RoleUuidOption { get; private set; } // option d + public Option RoleUuidOption { get; private set; } /// /// Gets or Sets RoleUuid /// [JsonPropertyName("role_uuid")] - public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new Option(value); } } // d + public Guid? RoleUuid { get { return this. RoleUuidOption; } set { this.RoleUuidOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -160,7 +160,7 @@ public override RolesReportsHash Read(ref Utf8JsonReader utf8JsonReader, Type ty if (roleUuid.IsSet && roleUuid.Value == null) throw new ArgumentNullException(nameof(roleUuid), "Property is not nullable for class RolesReportsHash."); - return new RolesReportsHash(role, roleUuid); // a + return new RolesReportsHash(role, roleUuid); } /// @@ -190,11 +190,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep if (rolesReportsHash.RoleOption.IsSet && rolesReportsHash.Role == null) throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); - if (rolesReportsHash.RoleOption.IsSet) // 14 + if (rolesReportsHash.RoleOption.IsSet) writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); if (rolesReportsHash.RoleUuidOption.IsSet) - writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); // 11 + writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 00a661adfaa4..c82e15cbc9de 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -46,13 +46,13 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override RolesReportsHashRole Read(ref Utf8JsonReader utf8JsonReader, Typ if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class RolesReportsHashRole."); - return new RolesReportsHashRole(name); // a + return new RolesReportsHashRole(name); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHashRole role throw new ArgumentNullException(nameof(rolesReportsHashRole.Name), "Property is required for class RolesReportsHashRole."); if (rolesReportsHashRole.NameOption.IsSet) - writer.WriteString("name", rolesReportsHashRole.Name); // 1 + writer.WriteString("name", rolesReportsHashRole.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs index 7f53a5055a5b..52a8e0d69c60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ScaleneTriangle.cs @@ -48,13 +48,13 @@ public ScaleneTriangle(string shapeType, string triangleType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override ScaleneTriangle Read(ref Utf8JsonReader utf8JsonReader, Type typ if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class ScaleneTriangle."); - return new ScaleneTriangle(shapeType.Value, triangleType.Value); // a + return new ScaleneTriangle(shapeType.Value, triangleType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, ScaleneTriangle scaleneTr if (scaleneTriangle.TriangleType == null) throw new ArgumentNullException(nameof(scaleneTriangle.TriangleType), "Property is required for class ScaleneTriangle."); - writer.WriteString("shapeType", scaleneTriangle.ShapeType); // 1 + writer.WriteString("shapeType", scaleneTriangle.ShapeType); - writer.WriteString("triangleType", scaleneTriangle.TriangleType); // 1 + writer.WriteString("triangleType", scaleneTriangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs index 0f3e3ae6ee76..575069f242e0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Shape.cs @@ -69,7 +69,7 @@ public Shape(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override Shape Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class Shape."); if (quadrilateral != null) - return new Shape(quadrilateral, shapeType.Value); // c + return new Shape(quadrilateral, shapeType.Value); if (triangle != null) - return new Shape(triangle, shapeType.Value); // c + return new Shape(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Shape shape, JsonSerializ if (shape.ShapeType == null) throw new ArgumentNullException(nameof(shape.ShapeType), "Property is required for class Shape."); - writer.WriteString("shapeType", shape.ShapeType); // 1 + writer.WriteString("shapeType", shape.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs index 9e7193f38251..5bd364cc6a41 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeInterface.cs @@ -46,7 +46,7 @@ public ShapeInterface(string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override ShapeInterface Read(ref Utf8JsonReader utf8JsonReader, Type type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeInterface."); - return new ShapeInterface(shapeType.Value); // a + return new ShapeInterface(shapeType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeInterface shapeInter if (shapeInterface.ShapeType == null) throw new ArgumentNullException(nameof(shapeInterface.ShapeType), "Property is required for class ShapeInterface."); - writer.WriteString("shapeType", shapeInterface.ShapeType); // 1 + writer.WriteString("shapeType", shapeInterface.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs index 3fdfa16615cf..a26dab034230 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ShapeOrNull.cs @@ -69,7 +69,7 @@ public ShapeOrNull(Quadrilateral quadrilateral, string shapeType) /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -200,10 +200,10 @@ public override ShapeOrNull Read(ref Utf8JsonReader utf8JsonReader, Type typeToC throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class ShapeOrNull."); if (quadrilateral != null) - return new ShapeOrNull(quadrilateral, shapeType.Value); // c + return new ShapeOrNull(quadrilateral, shapeType.Value); if (triangle != null) - return new ShapeOrNull(triangle, shapeType.Value); // c + return new ShapeOrNull(triangle, shapeType.Value); throw new JsonException(); } @@ -245,7 +245,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, ShapeOrNull shapeOrNull, if (shapeOrNull.ShapeType == null) throw new ArgumentNullException(nameof(shapeOrNull.ShapeType), "Property is required for class ShapeOrNull."); - writer.WriteString("shapeType", shapeOrNull.ShapeType); // 1 + writer.WriteString("shapeType", shapeOrNull.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs index 0edbb338199b..a00a87e2efa5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SimpleQuadrilateral.cs @@ -48,13 +48,13 @@ public SimpleQuadrilateral(string quadrilateralType, string shapeType) /// Gets or Sets QuadrilateralType /// [JsonPropertyName("quadrilateralType")] - public string QuadrilateralType { get; set; } // d + public string QuadrilateralType { get; set; } /// /// Gets or Sets ShapeType /// [JsonPropertyName("shapeType")] - public string ShapeType { get; set; } // d + public string ShapeType { get; set; } /// /// Gets or Sets additional properties @@ -152,7 +152,7 @@ public override SimpleQuadrilateral Read(ref Utf8JsonReader utf8JsonReader, Type if (shapeType.IsSet && shapeType.Value == null) throw new ArgumentNullException(nameof(shapeType), "Property is not nullable for class SimpleQuadrilateral."); - return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); // a + return new SimpleQuadrilateral(quadrilateralType.Value, shapeType.Value); } /// @@ -185,9 +185,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, SimpleQuadrilateral simpl if (simpleQuadrilateral.ShapeType == null) throw new ArgumentNullException(nameof(simpleQuadrilateral.ShapeType), "Property is required for class SimpleQuadrilateral."); - writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); // 1 + writer.WriteString("quadrilateralType", simpleQuadrilateral.QuadrilateralType); - writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); // 1 + writer.WriteString("shapeType", simpleQuadrilateral.ShapeType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index a74bb807a18c..9da2291ad11a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -48,25 +48,25 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] - public Option VarSpecialModelNameOption { get; private set; } // option d + public Option VarSpecialModelNameOption { get; private set; } /// /// Gets or Sets VarSpecialModelName /// [JsonPropertyName("_special_model.name_")] - public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new Option(value); } } // d + public string VarSpecialModelName { get { return this. VarSpecialModelNameOption; } set { this.VarSpecialModelNameOption = new Option(value); } } /// /// Used to track the state of SpecialPropertyName /// [JsonIgnore] - public Option SpecialPropertyNameOption { get; private set; } // option d + public Option SpecialPropertyNameOption { get; private set; } /// /// Gets or Sets SpecialPropertyName /// [JsonPropertyName("$special[property.name]")] - public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new Option(value); } } // d + public long? SpecialPropertyName { get { return this. SpecialPropertyNameOption; } set { this.SpecialPropertyNameOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override SpecialModelName Read(ref Utf8JsonReader utf8JsonReader, Type ty if (specialPropertyName.IsSet && specialPropertyName.Value == null) throw new ArgumentNullException(nameof(specialPropertyName), "Property is not nullable for class SpecialModelName."); - return new SpecialModelName(varSpecialModelName, specialPropertyName); // a + return new SpecialModelName(varSpecialModelName, specialPropertyName); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, SpecialModelName specialM throw new ArgumentNullException(nameof(specialModelName.VarSpecialModelName), "Property is required for class SpecialModelName."); if (specialModelName.VarSpecialModelNameOption.IsSet) - writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); // 1 + writer.WriteString("_special_model.name_", specialModelName.VarSpecialModelName); if (specialModelName.SpecialPropertyNameOption.IsSet) - writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); // 3 + writer.WriteNumber("$special[property.name]", specialModelName.SpecialPropertyNameOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index 51f37f758bf8..c156d31a3ef9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -48,25 +48,25 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Used to track the state of Name /// [JsonIgnore] - public Option NameOption { get; private set; } // option d + public Option NameOption { get; private set; } /// /// Gets or Sets Name /// [JsonPropertyName("name")] - public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } // d + public string Name { get { return this. NameOption; } set { this.NameOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -159,7 +159,7 @@ public override Tag Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (name.IsSet && name.Value == null) throw new ArgumentNullException(nameof(name), "Property is not nullable for class Tag."); - return new Tag(id, name); // a + return new Tag(id, name); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Tag tag, JsonSerializerOp throw new ArgumentNullException(nameof(tag.Name), "Property is required for class Tag."); if (tag.IdOption.IsSet) - writer.WriteNumber("id", tag.IdOption.Value.Value); // 3 + writer.WriteNumber("id", tag.IdOption.Value.Value); if (tag.NameOption.IsSet) - writer.WriteString("name", tag.Name); // 1 + writer.WriteString("name", tag.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index 64a088c088e9..ceaea2e1aa4e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -46,13 +46,13 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] - public Option ValueOption { get; private set; } // option d + public Option ValueOption { get; private set; } /// /// Gets or Sets Value /// [JsonPropertyName("value")] - public string Value { get { return this. ValueOption; } set { this.ValueOption = new Option(value); } } // d + public string Value { get { return this. ValueOption; } set { this.ValueOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -136,7 +136,7 @@ public override TestCollectionEndingWithWordList Read(ref Utf8JsonReader utf8Jso if (value.IsSet && value.Value == null) throw new ArgumentNullException(nameof(value), "Property is not nullable for class TestCollectionEndingWithWordList."); - return new TestCollectionEndingWithWordList(value); // a + return new TestCollectionEndingWithWordList(value); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordList.Value), "Property is required for class TestCollectionEndingWithWordList."); if (testCollectionEndingWithWordList.ValueOption.IsSet) - writer.WriteString("value", testCollectionEndingWithWordList.Value); // 1 + writer.WriteString("value", testCollectionEndingWithWordList.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 90470deb7933..5594a28119d7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -46,13 +46,13 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] - public Option> TestCollectionEndingWithWordListOption { get; private set; } // option d + public Option> TestCollectionEndingWithWordListOption { get; private set; } /// /// Gets or Sets TestCollectionEndingWithWordList /// [JsonPropertyName("TestCollectionEndingWithWordList")] - public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new Option>(value); } } // d + public List TestCollectionEndingWithWordList { get { return this. TestCollectionEndingWithWordListOption; } set { this.TestCollectionEndingWithWordListOption = new Option>(value); } } /// /// Gets or Sets additional properties @@ -137,7 +137,7 @@ public override TestCollectionEndingWithWordListObject Read(ref Utf8JsonReader u if (testCollectionEndingWithWordList.IsSet && testCollectionEndingWithWordList.Value == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordList), "Property is not nullable for class TestCollectionEndingWithWordListObject."); - return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); // a + return new TestCollectionEndingWithWordListObject(testCollectionEndingWithWordList); } /// @@ -167,7 +167,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet && testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList == null) throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); - if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) // 14 + if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index d68ce93a20c3..1a5e4f090270 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -46,13 +46,13 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Used to track the state of SomeProperty /// [JsonIgnore] - public Option SomePropertyOption { get; private set; } // option d + public Option SomePropertyOption { get; private set; } /// /// Gets or Sets SomeProperty /// [JsonPropertyName("someProperty")] - public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new Option(value); } } // d + public string SomeProperty { get { return this. SomePropertyOption; } set { this.SomePropertyOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -147,7 +147,7 @@ public override TestInlineFreeformAdditionalPropertiesRequest Read(ref Utf8JsonR if (someProperty.IsSet && someProperty.Value == null) throw new ArgumentNullException(nameof(someProperty), "Property is not nullable for class TestInlineFreeformAdditionalPropertiesRequest."); - return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); // a + return new TestInlineFreeformAdditionalPropertiesRequest(someProperty); } /// @@ -178,7 +178,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestInlineFreeformAdditio throw new ArgumentNullException(nameof(testInlineFreeformAdditionalPropertiesRequest.SomeProperty), "Property is required for class TestInlineFreeformAdditionalPropertiesRequest."); if (testInlineFreeformAdditionalPropertiesRequest.SomePropertyOption.IsSet) - writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); // 1 + writer.WriteString("someProperty", testInlineFreeformAdditionalPropertiesRequest.SomeProperty); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs index ca5cf704e909..737124e080b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Triangle.cs @@ -86,7 +86,7 @@ public Triangle(ScaleneTriangle scaleneTriangle, string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -223,13 +223,13 @@ public override Triangle Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class Triangle."); if (equilateralTriangle != null) - return new Triangle(equilateralTriangle, triangleType.Value); // c + return new Triangle(equilateralTriangle, triangleType.Value); if (isoscelesTriangle != null) - return new Triangle(isoscelesTriangle, triangleType.Value); // c + return new Triangle(isoscelesTriangle, triangleType.Value); if (scaleneTriangle != null) - return new Triangle(scaleneTriangle, triangleType.Value); // c + return new Triangle(scaleneTriangle, triangleType.Value); throw new JsonException(); } @@ -276,7 +276,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, Triangle triangle, JsonSe if (triangle.TriangleType == null) throw new ArgumentNullException(nameof(triangle.TriangleType), "Property is required for class Triangle."); - writer.WriteString("triangleType", triangle.TriangleType); // 1 + writer.WriteString("triangleType", triangle.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs index f21bcd8522f6..270c598de618 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TriangleInterface.cs @@ -46,7 +46,7 @@ public TriangleInterface(string triangleType) /// Gets or Sets TriangleType /// [JsonPropertyName("triangleType")] - public string TriangleType { get; set; } // d + public string TriangleType { get; set; } /// /// Gets or Sets additional properties @@ -133,7 +133,7 @@ public override TriangleInterface Read(ref Utf8JsonReader utf8JsonReader, Type t if (triangleType.IsSet && triangleType.Value == null) throw new ArgumentNullException(nameof(triangleType), "Property is not nullable for class TriangleInterface."); - return new TriangleInterface(triangleType.Value); // a + return new TriangleInterface(triangleType.Value); } /// @@ -163,7 +163,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, TriangleInterface triangl if (triangleInterface.TriangleType == null) throw new ArgumentNullException(nameof(triangleInterface.TriangleType), "Property is required for class TriangleInterface."); - writer.WriteString("triangleType", triangleInterface.TriangleType); // 1 + writer.WriteString("triangleType", triangleInterface.TriangleType); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index ea6bf7956cc2..6b599fe81727 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -68,150 +68,150 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Email /// [JsonIgnore] - public Option EmailOption { get; private set; } // option d + public Option EmailOption { get; private set; } /// /// Gets or Sets Email /// [JsonPropertyName("email")] - public string Email { get { return this. EmailOption; } set { this.EmailOption = new Option(value); } } // d + public string Email { get { return this. EmailOption; } set { this.EmailOption = new Option(value); } } /// /// Used to track the state of FirstName /// [JsonIgnore] - public Option FirstNameOption { get; private set; } // option d + public Option FirstNameOption { get; private set; } /// /// Gets or Sets FirstName /// [JsonPropertyName("firstName")] - public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new Option(value); } } // d + public string FirstName { get { return this. FirstNameOption; } set { this.FirstNameOption = new Option(value); } } /// /// Used to track the state of Id /// [JsonIgnore] - public Option IdOption { get; private set; } // option d + public Option IdOption { get; private set; } /// /// Gets or Sets Id /// [JsonPropertyName("id")] - public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } // d + public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } /// /// Used to track the state of LastName /// [JsonIgnore] - public Option LastNameOption { get; private set; } // option d + public Option LastNameOption { get; private set; } /// /// Gets or Sets LastName /// [JsonPropertyName("lastName")] - public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new Option(value); } } // d + public string LastName { get { return this. LastNameOption; } set { this.LastNameOption = new Option(value); } } /// /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. /// /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. [JsonPropertyName("objectWithNoDeclaredProps")] - public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new Option(value); } } // d + public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new Option(value); } } /// /// Used to track the state of Password /// [JsonIgnore] - public Option PasswordOption { get; private set; } // option d + public Option PasswordOption { get; private set; } /// /// Gets or Sets Password /// [JsonPropertyName("password")] - public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new Option(value); } } // d + public string Password { get { return this. PasswordOption; } set { this.PasswordOption = new Option(value); } } /// /// Used to track the state of Phone /// [JsonIgnore] - public Option PhoneOption { get; private set; } // option d + public Option PhoneOption { get; private set; } /// /// Gets or Sets Phone /// [JsonPropertyName("phone")] - public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new Option(value); } } // d + public string Phone { get { return this. PhoneOption; } set { this.PhoneOption = new Option(value); } } /// /// Used to track the state of UserStatus /// [JsonIgnore] - public Option UserStatusOption { get; private set; } // option d + public Option UserStatusOption { get; private set; } /// /// User Status /// /// User Status [JsonPropertyName("userStatus")] - public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new Option(value); } } // d + public int? UserStatus { get { return this. UserStatusOption; } set { this.UserStatusOption = new Option(value); } } /// /// Used to track the state of Username /// [JsonIgnore] - public Option UsernameOption { get; private set; } // option d + public Option UsernameOption { get; private set; } /// /// Gets or Sets Username /// [JsonPropertyName("username")] - public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new Option(value); } } // d + public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new Option(value); } } /// /// Used to track the state of AnyTypeProp /// [JsonIgnore] - public Option AnyTypePropOption { get; private set; } // option d + public Option AnyTypePropOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new Option(value); } } // d + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new Option(value); } } /// /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] - public Option AnyTypePropNullableOption { get; private set; } // option d + public Option AnyTypePropNullableOption { get; private set; } /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new Option(value); } } // d + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new Option(value); } } /// /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } // option d + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new Option(value); } } // d + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -380,7 +380,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); // a + return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); } /// @@ -429,33 +429,33 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); if (user.EmailOption.IsSet) - writer.WriteString("email", user.Email); // 1 + writer.WriteString("email", user.Email); if (user.FirstNameOption.IsSet) - writer.WriteString("firstName", user.FirstName); // 1 + writer.WriteString("firstName", user.FirstName); if (user.IdOption.IsSet) - writer.WriteNumber("id", user.IdOption.Value.Value); // 3 + writer.WriteNumber("id", user.IdOption.Value.Value); if (user.LastNameOption.IsSet) - writer.WriteString("lastName", user.LastName); // 1 + writer.WriteString("lastName", user.LastName); - if (user.ObjectWithNoDeclaredPropsOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsOption.IsSet) writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); if (user.PasswordOption.IsSet) - writer.WriteString("password", user.Password); // 1 + writer.WriteString("password", user.Password); if (user.PhoneOption.IsSet) - writer.WriteString("phone", user.Phone); // 1 + writer.WriteString("phone", user.Phone); if (user.UserStatusOption.IsSet) - writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); // 3 + writer.WriteNumber("userStatus", user.UserStatusOption.Value.Value); if (user.UsernameOption.IsSet) - writer.WriteString("username", user.Username); // 1 + writer.WriteString("username", user.Username); - if (user.AnyTypePropOption.IsSet) // 14 + if (user.AnyTypePropOption.IsSet) if (user.AnyTypePropOption.Value != null) { writer.WritePropertyName("anyTypeProp"); @@ -463,7 +463,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) // 14 + if (user.AnyTypePropNullableOption.IsSet) if (user.AnyTypePropNullableOption.Value != null) { writer.WritePropertyName("anyTypePropNullable"); @@ -471,7 +471,7 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer } else writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) // 14 + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) { writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index 37608caae3cb..55d2f2b0c6d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -50,31 +50,31 @@ public Whale(string className, Option hasBaleen = default, Option /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Used to track the state of HasBaleen /// [JsonIgnore] - public Option HasBaleenOption { get; private set; } // option d + public Option HasBaleenOption { get; private set; } /// /// Gets or Sets HasBaleen /// [JsonPropertyName("hasBaleen")] - public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new Option(value); } } // d + public bool? HasBaleen { get { return this. HasBaleenOption; } set { this.HasBaleenOption = new Option(value); } } /// /// Used to track the state of HasTeeth /// [JsonIgnore] - public Option HasTeethOption { get; private set; } // option d + public Option HasTeethOption { get; private set; } /// /// Gets or Sets HasTeeth /// [JsonPropertyName("hasTeeth")] - public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new Option(value); } } // d + public bool? HasTeeth { get { return this. HasTeethOption; } set { this.HasTeethOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -179,7 +179,7 @@ public override Whale Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (hasTeeth.IsSet && hasTeeth.Value == null) throw new ArgumentNullException(nameof(hasTeeth), "Property is not nullable for class Whale."); - return new Whale(className.Value, hasBaleen, hasTeeth); // a + return new Whale(className.Value, hasBaleen, hasTeeth); } /// @@ -209,13 +209,13 @@ public void WriteProperties(ref Utf8JsonWriter writer, Whale whale, JsonSerializ if (whale.ClassName == null) throw new ArgumentNullException(nameof(whale.ClassName), "Property is required for class Whale."); - writer.WriteString("className", whale.ClassName); // 1 + writer.WriteString("className", whale.ClassName); if (whale.HasBaleenOption.IsSet) - writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); // 2 + writer.WriteBoolean("hasBaleen", whale.HasBaleenOption.Value.Value); if (whale.HasTeethOption.IsSet) - writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); // 2 + writer.WriteBoolean("hasTeeth", whale.HasTeethOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index 896c3ba6f7d4..bf474ddc5515 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -128,19 +128,19 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] - public Option TypeOption { get; private set; } // option a + public Option TypeOption { get; private set; } /// /// Gets or Sets Type /// [JsonPropertyName("type")] - public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new Option(value); } } // a + public TypeEnum? Type { get { return this.TypeOption; } set { this.TypeOption = new Option(value); } } /// /// Gets or Sets ClassName /// [JsonPropertyName("className")] - public string ClassName { get; set; } // d + public string ClassName { get; set; } /// /// Gets or Sets additional properties @@ -248,7 +248,7 @@ public override Zebra Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (type.IsSet && type.Value == null) throw new ArgumentNullException(nameof(type), "Property is not nullable for class Zebra."); - return new Zebra(className.Value, type); // a + return new Zebra(className.Value, type); } /// @@ -278,9 +278,9 @@ public void WriteProperties(ref Utf8JsonWriter writer, Zebra zebra, JsonSerializ if (zebra.ClassName == null) throw new ArgumentNullException(nameof(zebra.ClassName), "Property is required for class Zebra."); - writer.WriteString("className", zebra.ClassName); // 1 + writer.WriteString("className", zebra.ClassName); - var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); // 7 + var typeRawValue = Zebra.TypeEnumToJsonValue(zebra.TypeOption.Value.Value); if (typeRawValue != null) writer.WriteString("type", typeRawValue); else diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 628624c9aa3f..6134606bedb1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -112,13 +112,13 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] - public Option ZeroBasedEnumOption { get; private set; } // option a + public Option ZeroBasedEnumOption { get; private set; } /// /// Gets or Sets ZeroBasedEnum /// [JsonPropertyName("ZeroBasedEnum")] - public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new Option(value); } } // a + public ZeroBasedEnumEnum? ZeroBasedEnum { get { return this.ZeroBasedEnumOption; } set { this.ZeroBasedEnumOption = new Option(value); } } /// /// Gets or Sets additional properties @@ -204,7 +204,7 @@ public override ZeroBasedEnumClass Read(ref Utf8JsonReader utf8JsonReader, Type if (zeroBasedEnum.IsSet && zeroBasedEnum.Value == null) throw new ArgumentNullException(nameof(zeroBasedEnum), "Property is not nullable for class ZeroBasedEnumClass."); - return new ZeroBasedEnumClass(zeroBasedEnum); // a + return new ZeroBasedEnumClass(zeroBasedEnum); } /// @@ -231,7 +231,7 @@ public override void Write(Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEn /// public void WriteProperties(ref Utf8JsonWriter writer, ZeroBasedEnumClass zeroBasedEnumClass, JsonSerializerOptions jsonSerializerOptions) { - var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); // 7 + var zeroBasedEnumRawValue = ZeroBasedEnumClass.ZeroBasedEnumEnumToJsonValue(zeroBasedEnumClass.ZeroBasedEnumOption.Value.Value); if (zeroBasedEnumRawValue != null) writer.WriteString("ZeroBasedEnum", zeroBasedEnumRawValue); else From 2527e1227b4a05cd1ff47634fe86ccc56b0244fb Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 14:49:06 -0500 Subject: [PATCH 18/23] revert changes to unused file --- .../resources/csharp/ValidateRegex.mustache | 11 ++---- ...odels-for-testing-with-http-signature.yaml | 2 -- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Apple.cs | 27 ++------------ .../src/Org.OpenAPITools/Model/FormatTest.cs | 36 +++---------------- ...dPropertiesAndAdditionalPropertiesClass.cs | 9 +---- .../src/Org.OpenAPITools/Model/Category.cs | 9 +---- 24 files changed, 59 insertions(+), 467 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache index dd208dafacea..15cf626dc012 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ValidateRegex.mustache @@ -1,13 +1,6 @@ // {{{name}}} ({{{dataType}}}) pattern Regex regex{{{name}}} = new Regex(@"{{{vendorExtensions.x-regex}}}"{{#vendorExtensions.x-modifiers}}{{#-first}}, {{/-first}}RegexOptions.{{{.}}}{{^-last}} | {{/-last}}{{/vendorExtensions.x-modifiers}}); -if (this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}} != null && !regex{{{name}}}.Match(this.{{{name}}}{{#useGenericHost}}{{^required}}Option.Value{{/required}}{{/useGenericHost}}{{#isUuid}}.ToString(){{/isUuid}}).Success) +if (!regex{{{name}}}.Match(this.{{{name}}}{{#isUuid}}.ToString(){{/isUuid}}).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for {{{name}}}, must match a pattern of " + regex{{{name}}}, new [] { "{{{name}}}" }); -} - - - - - - -// TODO: revert changes here \ No newline at end of file +} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 0dc312b891ec..0ebc00da6325 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -2088,8 +2088,6 @@ components: - 1 - -1 - - required_nullable_enum_integer_only: type: integer nullable: true diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs index b872ab7d9b25..031f318ee0e4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/Apple.cs @@ -220,49 +220,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs index 45aeb448ee99..73785b74a8fe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/FormatTest.cs @@ -834,17 +834,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -862,49 +855,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 2125bde56e75..7f449dad8a66 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-ConditionalSerialization/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -255,17 +255,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs index 63b142690676..2728aa9a25af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/Apple.cs @@ -155,49 +155,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs index f95bce90aae6..0bd9d03d007a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -433,17 +433,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -461,49 +454,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index b1011f770a1a..7aae060d7a45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-httpclient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -168,17 +168,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs index 1df6354dc026..5ff006145c2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/Apple.cs @@ -154,49 +154,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs index 43473b1efea3..8a1f7d62fa27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,17 +432,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -460,49 +453,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5bf84c73a24b..ec3e8e7b68c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net47/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,17 +167,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs index 1df6354dc026..5ff006145c2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/Apple.cs @@ -154,49 +154,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs index 43473b1efea3..8a1f7d62fa27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,17 +432,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -460,49 +453,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5bf84c73a24b..ec3e8e7b68c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net48/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,17 +167,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs index 1df6354dc026..5ff006145c2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/Apple.cs @@ -154,49 +154,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs index 43473b1efea3..8a1f7d62fa27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,17 +432,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -460,49 +453,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5bf84c73a24b..ec3e8e7b68c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-net5.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,17 +167,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs index 1df6354dc026..5ff006145c2f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Apple.cs @@ -154,49 +154,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs index 43473b1efea3..8a1f7d62fa27 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/FormatTest.cs @@ -432,17 +432,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -460,49 +453,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 5bf84c73a24b..ec3e8e7b68c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -167,17 +167,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs index f8cb3223116f..120c4643d81e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/Apple.cs @@ -142,49 +142,28 @@ public override int GetHashCode() if (this.Cultivar != null) { // Cultivar (string) pattern Regex regexCultivar = new Regex(@"^[a-zA-Z\s]*$", RegexOptions.CultureInvariant); - if (this.Cultivar != null && !regexCultivar.Match(this.Cultivar).Success) + if (!regexCultivar.Match(this.Cultivar).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Cultivar, must match a pattern of " + regexCultivar, new [] { "Cultivar" }); } - - - - - - - // TODO: revert changes here } if (this.Origin != null) { // Origin (string) pattern Regex regexOrigin = new Regex(@"^[A-Z\s]*$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.Origin != null && !regexOrigin.Match(this.Origin).Success) + if (!regexOrigin.Match(this.Origin).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Origin, must match a pattern of " + regexOrigin, new [] { "Origin" }); } - - - - - - - // TODO: revert changes here } if (this.ColorCode != null) { // ColorCode (string) pattern Regex regexColorCode = new Regex(@"^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$", RegexOptions.CultureInvariant); - if (this.ColorCode != null && !regexColorCode.Match(this.ColorCode).Success) + if (!regexColorCode.Match(this.ColorCode).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for ColorCode, must match a pattern of " + regexColorCode, new [] { "ColorCode" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs index 11f08ffcb968..d5e9e3c94d41 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/FormatTest.cs @@ -417,17 +417,10 @@ public override int GetHashCode() if (this.VarString != null) { // VarString (string) pattern Regex regexVarString = new Regex(@"[a-z]", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.VarString != null && !regexVarString.Match(this.VarString).Success) + if (!regexVarString.Match(this.VarString).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for VarString, must match a pattern of " + regexVarString, new [] { "VarString" }); } - - - - - - - // TODO: revert changes here } // Password (string) maxLength @@ -445,49 +438,28 @@ public override int GetHashCode() if (this.PatternWithDigits != null) { // PatternWithDigits (string) pattern Regex regexPatternWithDigits = new Regex(@"^\d{10}$", RegexOptions.CultureInvariant); - if (this.PatternWithDigits != null && !regexPatternWithDigits.Match(this.PatternWithDigits).Success) + if (!regexPatternWithDigits.Match(this.PatternWithDigits).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigits, must match a pattern of " + regexPatternWithDigits, new [] { "PatternWithDigits" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithDigitsAndDelimiter != null) { // PatternWithDigitsAndDelimiter (string) pattern Regex regexPatternWithDigitsAndDelimiter = new Regex(@"^image_\d{1,3}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase); - if (this.PatternWithDigitsAndDelimiter != null && !regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) + if (!regexPatternWithDigitsAndDelimiter.Match(this.PatternWithDigitsAndDelimiter).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithDigitsAndDelimiter, must match a pattern of " + regexPatternWithDigitsAndDelimiter, new [] { "PatternWithDigitsAndDelimiter" }); } - - - - - - - // TODO: revert changes here } if (this.PatternWithBackslash != null) { // PatternWithBackslash (string) pattern Regex regexPatternWithBackslash = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$", RegexOptions.CultureInvariant); - if (this.PatternWithBackslash != null && !regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) + if (!regexPatternWithBackslash.Match(this.PatternWithBackslash).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for PatternWithBackslash, must match a pattern of " + regexPatternWithBackslash, new [] { "PatternWithBackslash" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 1d9f5d51a23c..0ecaac953c3c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCore/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -155,17 +155,10 @@ public override int GetHashCode() if (this.UuidWithPattern != null) { // UuidWithPattern (Guid) pattern Regex regexUuidWithPattern = new Regex(@"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", RegexOptions.CultureInvariant); - if (this.UuidWithPattern != null && !regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) + if (!regexUuidWithPattern.Match(this.UuidWithPattern.ToString()).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for UuidWithPattern, must match a pattern of " + regexUuidWithPattern, new [] { "UuidWithPattern" }); } - - - - - - - // TODO: revert changes here } yield break; diff --git a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs index 730319f8038b..968c28f9a2cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClientCoreAndNet47/src/Org.OpenAPITools/Model/Category.cs @@ -126,17 +126,10 @@ public override int GetHashCode() if (this.Name != null) { // Name (string) pattern Regex regexName = new Regex(@"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$", RegexOptions.CultureInvariant); - if (this.Name != null && !regexName.Match(this.Name).Success) + if (!regexName.Match(this.Name).Success) { yield return new System.ComponentModel.DataAnnotations.ValidationResult("Invalid value for Name, must match a pattern of " + regexName, new [] { "Name" }); } - - - - - - - // TODO: revert changes here } yield break; From 9cbc15e5bd246f7a5f67510f2f12291c911197c5 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 14:58:18 -0500 Subject: [PATCH 19/23] removed unused lambdas --- .../codegen/languages/AbstractCSharpCodegen.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 2f99a61a8b84..f8cdfecfaa3b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -412,7 +412,6 @@ public void execute(Template.Fragment fragment, Writer writer) throws IOExceptio @Override protected ImmutableMap.Builder addMustacheLambdas() { CopyLambda copyLambda = new CopyLambda(); - CopyLambda copyLambda2 = new CopyLambda(); return super.addMustacheLambdas() .put("camelcase_param", new CamelCaseLambda().generator(this).escapeAsParamName(true)) @@ -430,17 +429,10 @@ protected ImmutableMap.Builder addMustacheLambdas() { .put("indent1", new IndentedLambda(4, " ", false, true)) .put("indent3", new IndentedLambda(12, " ", false, true)) .put("indent4", new IndentedLambda(16, " ", false, true)) - .put("indentLine1", new IndentedLambda(4, " ", true, true)) - .put("indentLine3", new IndentedLambda(12, " ", true, true)) - .put("indentLine4", new IndentedLambda(16, " ", true, true)) - .put("uniqueLinesWithNewLine", new UniqueLambda("\n", true)) - .put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda(true)) .put("copy", copyLambda) - .put("copy2", copyLambda2) .put("paste", new PasteLambda(copyLambda, true, true, true, false)) .put("pasteOnce", new PasteLambda(copyLambda, true, true, true, true)) - .put("pasteLine", new PasteLambda(copyLambda, true, true, false, false)) - .put("pasteLine2", new PasteLambda(copyLambda2, true, true, false, false)); + .put("pasteLine", new PasteLambda(copyLambda, true, true, false, false)); } @Override From 9cf3ee3ff5eef9f24a94e5982098bdc09b2dd408 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 16:51:14 -0500 Subject: [PATCH 20/23] fix a serialization bug --- .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 779559982ba4..e33388496f57 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -324,8 +324,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); if (enumArrays.ArrayEnumOption.IsSet) + { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); From 25d2df1bbfdfc1064aeae21225af4cccf5efc5ad Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 16:57:17 -0500 Subject: [PATCH 21/23] make option a hidden property --- .../generichost/JsonConverter.mustache | 10 ++++---- .../generichost/modelGeneric.mustache | 4 ++++ .../src/UseSourceGeneration/Model/Activity.cs | 3 +++ .../ActivityOutputElementRepresentation.cs | 4 ++++ .../Model/AdditionalPropertiesClass.cs | 22 +++++++++++++++++ .../src/UseSourceGeneration/Model/Animal.cs | 1 + .../UseSourceGeneration/Model/ApiResponse.cs | 3 +++ .../src/UseSourceGeneration/Model/Apple.cs | 3 +++ .../src/UseSourceGeneration/Model/AppleReq.cs | 1 + .../Model/ArrayOfArrayOfNumberOnly.cs | 3 +++ .../Model/ArrayOfNumberOnly.cs | 3 +++ .../UseSourceGeneration/Model/ArrayTest.cs | 9 +++++++ .../src/UseSourceGeneration/Model/Banana.cs | 1 + .../UseSourceGeneration/Model/BananaReq.cs | 1 + .../Model/Capitalization.cs | 6 +++++ .../src/UseSourceGeneration/Model/Cat.cs | 1 + .../src/UseSourceGeneration/Model/Category.cs | 1 + .../src/UseSourceGeneration/Model/ChildCat.cs | 2 ++ .../UseSourceGeneration/Model/ClassModel.cs | 1 + .../Model/DateOnlyClass.cs | 1 + .../Model/DeprecatedObject.cs | 1 + .../src/UseSourceGeneration/Model/Dog.cs | 1 + .../src/UseSourceGeneration/Model/Drawing.cs | 8 +++++++ .../UseSourceGeneration/Model/EnumArrays.cs | 4 ++++ .../src/UseSourceGeneration/Model/EnumTest.cs | 8 +++++++ .../src/UseSourceGeneration/Model/File.cs | 1 + .../Model/FileSchemaTestClass.cs | 6 +++++ .../src/UseSourceGeneration/Model/Foo.cs | 1 + .../Model/FooGetDefaultResponse.cs | 3 +++ .../UseSourceGeneration/Model/FormatTest.cs | 19 +++++++++++++++ .../src/UseSourceGeneration/Model/Fruit.cs | 1 + .../src/UseSourceGeneration/Model/GmFruit.cs | 3 +++ .../Model/HasOnlyReadOnly.cs | 2 ++ .../Model/HealthCheckResult.cs | 1 + .../src/UseSourceGeneration/Model/List.cs | 1 + .../Model/LiteralStringClass.cs | 2 ++ .../src/UseSourceGeneration/Model/MapTest.cs | 12 ++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 6 +++++ .../Model/Model200Response.cs | 2 ++ .../UseSourceGeneration/Model/ModelClient.cs | 1 + .../src/UseSourceGeneration/Model/Name.cs | 3 +++ .../Model/NullableClass.cs | 16 +++++++++++++ .../Model/NullableGuidClass.cs | 1 + .../UseSourceGeneration/Model/NumberOnly.cs | 1 + .../Model/ObjectWithDeprecatedFields.cs | 8 +++++++ .../src/UseSourceGeneration/Model/Order.cs | 6 +++++ .../Model/OuterComposite.cs | 3 +++ .../src/UseSourceGeneration/Model/Pet.cs | 8 +++++++ .../Model/ReadOnlyFirst.cs | 2 ++ .../Model/RequiredClass.cs | 24 +++++++++++++++++++ .../src/UseSourceGeneration/Model/Return.cs | 1 + .../Model/RolesReportsHash.cs | 4 ++++ .../Model/RolesReportsHashRole.cs | 1 + .../Model/SpecialModelName.cs | 2 ++ .../src/UseSourceGeneration/Model/Tag.cs | 2 ++ .../Model/TestCollectionEndingWithWordList.cs | 1 + .../TestCollectionEndingWithWordListObject.cs | 3 +++ ...lineFreeformAdditionalPropertiesRequest.cs | 1 + .../src/UseSourceGeneration/Model/User.cs | 14 +++++++++++ .../src/UseSourceGeneration/Model/Whale.cs | 2 ++ .../src/UseSourceGeneration/Model/Zebra.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/Activity.cs | 3 +++ .../ActivityOutputElementRepresentation.cs | 4 ++++ .../Model/AdditionalPropertiesClass.cs | 22 +++++++++++++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 1 + .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 3 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 1 + .../Model/ArrayOfArrayOfNumberOnly.cs | 3 +++ .../Model/ArrayOfNumberOnly.cs | 3 +++ .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++++++ .../src/Org.OpenAPITools/Model/Banana.cs | 1 + .../src/Org.OpenAPITools/Model/BananaReq.cs | 1 + .../Org.OpenAPITools/Model/Capitalization.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Cat.cs | 1 + .../src/Org.OpenAPITools/Model/Category.cs | 1 + .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 ++ .../src/Org.OpenAPITools/Model/ClassModel.cs | 1 + .../Org.OpenAPITools/Model/DateOnlyClass.cs | 1 + .../Model/DeprecatedObject.cs | 1 + .../src/Org.OpenAPITools/Model/Dog.cs | 1 + .../src/Org.OpenAPITools/Model/Drawing.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 4 ++++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/File.cs | 1 + .../Model/FileSchemaTestClass.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Foo.cs | 1 + .../Model/FooGetDefaultResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 19 +++++++++++++++ .../src/Org.OpenAPITools/Model/Fruit.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 +++ .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 2 ++ .../Model/HealthCheckResult.cs | 1 + .../src/Org.OpenAPITools/Model/List.cs | 1 + .../Model/LiteralStringClass.cs | 2 ++ .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 6 +++++ .../Model/Model200Response.cs | 2 ++ .../src/Org.OpenAPITools/Model/ModelClient.cs | 1 + .../src/Org.OpenAPITools/Model/Name.cs | 3 +++ .../Org.OpenAPITools/Model/NullableClass.cs | 16 +++++++++++++ .../Model/NullableGuidClass.cs | 1 + .../src/Org.OpenAPITools/Model/NumberOnly.cs | 1 + .../Model/ObjectWithDeprecatedFields.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/Order.cs | 6 +++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 8 +++++++ .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 2 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 24 +++++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 1 + .../Model/RolesReportsHash.cs | 4 ++++ .../Model/RolesReportsHashRole.cs | 1 + .../Model/SpecialModelName.cs | 2 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 2 ++ .../Model/TestCollectionEndingWithWordList.cs | 1 + .../TestCollectionEndingWithWordListObject.cs | 3 +++ ...lineFreeformAdditionalPropertiesRequest.cs | 1 + .../src/Org.OpenAPITools/Model/User.cs | 14 +++++++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 2 ++ .../src/Org.OpenAPITools/Model/Zebra.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/Activity.cs | 3 +++ .../ActivityOutputElementRepresentation.cs | 4 ++++ .../Model/AdditionalPropertiesClass.cs | 22 +++++++++++++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 1 + .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 3 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 1 + .../Model/ArrayOfArrayOfNumberOnly.cs | 3 +++ .../Model/ArrayOfNumberOnly.cs | 3 +++ .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++++++ .../src/Org.OpenAPITools/Model/Banana.cs | 1 + .../src/Org.OpenAPITools/Model/BananaReq.cs | 1 + .../Org.OpenAPITools/Model/Capitalization.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Cat.cs | 1 + .../src/Org.OpenAPITools/Model/Category.cs | 1 + .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 ++ .../src/Org.OpenAPITools/Model/ClassModel.cs | 1 + .../Org.OpenAPITools/Model/DateOnlyClass.cs | 1 + .../Model/DeprecatedObject.cs | 1 + .../src/Org.OpenAPITools/Model/Dog.cs | 1 + .../src/Org.OpenAPITools/Model/Drawing.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 2 ++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/File.cs | 1 + .../Model/FileSchemaTestClass.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Foo.cs | 1 + .../Model/FooGetDefaultResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 19 +++++++++++++++ .../src/Org.OpenAPITools/Model/Fruit.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 +++ .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 2 ++ .../Model/HealthCheckResult.cs | 1 + .../src/Org.OpenAPITools/Model/List.cs | 1 + .../Model/LiteralStringClass.cs | 2 ++ .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 6 +++++ .../Model/Model200Response.cs | 2 ++ .../src/Org.OpenAPITools/Model/ModelClient.cs | 1 + .../src/Org.OpenAPITools/Model/Name.cs | 3 +++ .../Org.OpenAPITools/Model/NullableClass.cs | 16 +++++++++++++ .../Model/NullableGuidClass.cs | 1 + .../src/Org.OpenAPITools/Model/NumberOnly.cs | 1 + .../Model/ObjectWithDeprecatedFields.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/Order.cs | 6 +++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 8 +++++++ .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 2 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 24 +++++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 1 + .../Model/RolesReportsHash.cs | 4 ++++ .../Model/RolesReportsHashRole.cs | 1 + .../Model/SpecialModelName.cs | 2 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 2 ++ .../Model/TestCollectionEndingWithWordList.cs | 1 + .../TestCollectionEndingWithWordListObject.cs | 3 +++ ...lineFreeformAdditionalPropertiesRequest.cs | 1 + .../src/Org.OpenAPITools/Model/User.cs | 14 +++++++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 2 ++ .../src/Org.OpenAPITools/Model/Zebra.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 1 + .../src/Org.OpenAPITools/Model/Adult.cs | 3 +++ .../src/Org.OpenAPITools/Model/Child.cs | 2 ++ .../src/Org.OpenAPITools/Model/Person.cs | 3 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 1 + .../src/Org.OpenAPITools/Model/Banana.cs | 1 + .../src/Org.OpenAPITools/Model/Fruit.cs | 3 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 1 + .../src/Org.OpenAPITools/Model/Banana.cs | 1 + .../src/Org.OpenAPITools/Model/Fruit.cs | 1 + .../src/Org.OpenAPITools/Model/Activity.cs | 3 +++ .../ActivityOutputElementRepresentation.cs | 4 ++++ .../Model/AdditionalPropertiesClass.cs | 22 +++++++++++++++++ .../src/Org.OpenAPITools/Model/Animal.cs | 1 + .../src/Org.OpenAPITools/Model/ApiResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/Apple.cs | 3 +++ .../src/Org.OpenAPITools/Model/AppleReq.cs | 1 + .../Model/ArrayOfArrayOfNumberOnly.cs | 3 +++ .../Model/ArrayOfNumberOnly.cs | 3 +++ .../src/Org.OpenAPITools/Model/ArrayTest.cs | 9 +++++++ .../src/Org.OpenAPITools/Model/Banana.cs | 1 + .../src/Org.OpenAPITools/Model/BananaReq.cs | 1 + .../Org.OpenAPITools/Model/Capitalization.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Cat.cs | 1 + .../src/Org.OpenAPITools/Model/Category.cs | 1 + .../src/Org.OpenAPITools/Model/ChildCat.cs | 2 ++ .../src/Org.OpenAPITools/Model/ClassModel.cs | 1 + .../Org.OpenAPITools/Model/DateOnlyClass.cs | 1 + .../Model/DeprecatedObject.cs | 1 + .../src/Org.OpenAPITools/Model/Dog.cs | 1 + .../src/Org.OpenAPITools/Model/Drawing.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/EnumArrays.cs | 4 ++++ .../src/Org.OpenAPITools/Model/EnumTest.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/File.cs | 1 + .../Model/FileSchemaTestClass.cs | 6 +++++ .../src/Org.OpenAPITools/Model/Foo.cs | 1 + .../Model/FooGetDefaultResponse.cs | 3 +++ .../src/Org.OpenAPITools/Model/FormatTest.cs | 19 +++++++++++++++ .../src/Org.OpenAPITools/Model/Fruit.cs | 1 + .../src/Org.OpenAPITools/Model/GmFruit.cs | 3 +++ .../Org.OpenAPITools/Model/HasOnlyReadOnly.cs | 2 ++ .../Model/HealthCheckResult.cs | 1 + .../src/Org.OpenAPITools/Model/List.cs | 1 + .../Model/LiteralStringClass.cs | 2 ++ .../src/Org.OpenAPITools/Model/MapTest.cs | 12 ++++++++++ ...dPropertiesAndAdditionalPropertiesClass.cs | 6 +++++ .../Model/Model200Response.cs | 2 ++ .../src/Org.OpenAPITools/Model/ModelClient.cs | 1 + .../src/Org.OpenAPITools/Model/Name.cs | 3 +++ .../Org.OpenAPITools/Model/NullableClass.cs | 16 +++++++++++++ .../Model/NullableGuidClass.cs | 1 + .../src/Org.OpenAPITools/Model/NumberOnly.cs | 1 + .../Model/ObjectWithDeprecatedFields.cs | 8 +++++++ .../src/Org.OpenAPITools/Model/Order.cs | 6 +++++ .../Org.OpenAPITools/Model/OuterComposite.cs | 3 +++ .../src/Org.OpenAPITools/Model/Pet.cs | 8 +++++++ .../Org.OpenAPITools/Model/ReadOnlyFirst.cs | 2 ++ .../Org.OpenAPITools/Model/RequiredClass.cs | 24 +++++++++++++++++++ .../src/Org.OpenAPITools/Model/Return.cs | 1 + .../Model/RolesReportsHash.cs | 4 ++++ .../Model/RolesReportsHashRole.cs | 1 + .../Model/SpecialModelName.cs | 2 ++ .../src/Org.OpenAPITools/Model/Tag.cs | 2 ++ .../Model/TestCollectionEndingWithWordList.cs | 1 + .../TestCollectionEndingWithWordListObject.cs | 3 +++ ...lineFreeformAdditionalPropertiesRequest.cs | 1 + .../src/Org.OpenAPITools/Model/User.cs | 14 +++++++++++ .../src/Org.OpenAPITools/Model/Whale.cs | 2 ++ .../src/Org.OpenAPITools/Model/Zebra.cs | 1 + .../Model/ZeroBasedEnumClass.cs | 1 + 251 files changed, 1040 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/JsonConverter.mustache index 4517e15ca317..9967867ac018 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 @@ -544,7 +544,7 @@ {{/required}} {{^required}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.IsSet) - {{#isNullable}} + {{#isNullable}} if ({{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}Option.Value != null) { writer.WritePropertyName("{{baseName}}"); @@ -552,11 +552,13 @@ } else writer.WriteNull("{{baseName}}"); - {{/isNullable}} - {{^isNullable}} + {{/isNullable}} + {{^isNullable}} + { writer.WritePropertyName("{{baseName}}"); JsonSerializer.Serialize(writer, {{#lambda.camelcase_param}}{{classname}}{{/lambda.camelcase_param}}.{{name}}, jsonSerializerOptions); - {{/isNullable}} + } + {{/isNullable}} {{/required}} {{/isDateTime}} {{/isDate}} diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache index bbc7b54df400..62ed3f172abe 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/modelGeneric.mustache @@ -89,6 +89,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} @@ -116,6 +117,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public {{#isNew}}new {{/isNew}}Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{#lambda.titlecase}}{{baseType}}{{/lambda.titlecase}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} @@ -158,6 +160,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public new Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} @@ -182,6 +185,7 @@ /// Used to track the state of {{{name}}} /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option<{{{datatypeWithEnum}}}{{>NullConditionalProperty}}> {{name}}Option { get; {{^isReadOnly}}private set; {{/isReadOnly}}} {{/required}} diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs index ac83bb614c64..d86feea2f500 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Activity.cs @@ -49,6 +49,7 @@ public Activity(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ActivityOutputsOption { get; private set; } /// @@ -171,8 +172,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); if (activity.ActivityOutputsOption.IsSet) + { writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs index 89ee64c5eeb9..3e94618e5cfe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ActivityOutputElementRepresentation.cs @@ -51,6 +51,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop1 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop1Option { get; private set; } /// @@ -63,6 +64,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop2 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop2Option { get; private set; } /// @@ -199,8 +201,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); if (activityOutputElementRepresentation.Prop2Option.IsSet) + { writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index c3ad7987b21c..5cc440012987 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -63,6 +63,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmptyMapOption { get; private set; } /// @@ -76,6 +77,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> MapOfMapPropertyOption { get; private set; } /// @@ -88,6 +90,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapPropertyOption { get; private set; } /// @@ -100,6 +103,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// @@ -112,6 +116,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// @@ -124,6 +129,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// @@ -136,6 +142,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } /// @@ -148,6 +155,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Anytype1Option { get; private set; } /// @@ -348,26 +356,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); if (additionalPropertiesClass.EmptyMapOption.IsSet) + { writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapPropertyOption.IsSet) + { writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs index b5fd1caf1052..d07daedca7fb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Animal.cs @@ -57,6 +57,7 @@ public Animal(string className, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs index 2ab7a6609859..32f43734f0ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ApiResponse.cs @@ -53,6 +53,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Code /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CodeOption { get; private set; } /// @@ -65,6 +66,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Message /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MessageOption { get; private set; } /// @@ -77,6 +79,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs index 6848784396a3..83db95beaff9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Apple.cs @@ -53,6 +53,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of ColorCode /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorCodeOption { get; private set; } /// @@ -65,6 +66,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of Cultivar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CultivarOption { get; private set; } /// @@ -77,6 +79,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of Origin /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OriginOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs index 9663e71bc61c..33a606d744a9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AppleReq.cs @@ -57,6 +57,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Used to track the state of Mealy /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MealyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs index 04a75c0eaa76..852333df6a5c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfArrayOfNumberOnly.cs @@ -49,6 +49,7 @@ public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayNumberOption { get; private set; } /// @@ -171,8 +172,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs index 54e4a1528c3d..3366dbdb1a5a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayOfNumberOnly.cs @@ -49,6 +49,7 @@ public ArrayOfNumberOnly(Option?> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayNumberOption { get; private set; } /// @@ -171,8 +172,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs index 7f6b9b4186fb..6b6ce17d389d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ArrayTest.cs @@ -53,6 +53,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayOfIntegerOption { get; private set; } /// @@ -65,6 +66,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayOfModelOption { get; private set; } /// @@ -77,6 +79,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayOfStringOption { get; private set; } /// @@ -223,14 +226,20 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } if (arrayTest.ArrayArrayOfModelOption.IsSet) + { writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } if (arrayTest.ArrayOfStringOption.IsSet) + { writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs index 6cd9dc70708a..3daafe3df5bf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Banana.cs @@ -49,6 +49,7 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LengthCmOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs index a0633ea3256e..87bb604c63a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/BananaReq.cs @@ -57,6 +57,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Used to track the state of Sweet /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SweetOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs index 0ddd6c8f3361..9394170cc39e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Capitalization.cs @@ -59,6 +59,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of ATT_NAME /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ATT_NAMEOption { get; private set; } /// @@ -72,6 +73,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of CapitalCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalCamelOption { get; private set; } /// @@ -84,6 +86,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of CapitalSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalSnakeOption { get; private set; } /// @@ -96,6 +99,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SCAETHFlowPointsOption { get; private set; } /// @@ -108,6 +112,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SmallCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallCamelOption { get; private set; } /// @@ -120,6 +125,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SmallSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallSnakeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index d19644f68a36..beb26efb5d47 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -51,6 +51,7 @@ public Cat(string className, Option declawed = default, Option c /// Used to track the state of Declawed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeclawedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 307da6102a9a..9215bd87cbca 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -57,6 +57,7 @@ public Category(string name = @"default-name", Option id = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs index 0d1f07c815ee..ca3b07960c86 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ChildCat.cs @@ -103,6 +103,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public new Option PetTypeOption { get; private set; } /// @@ -115,6 +116,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs index ea3eb9058b94..3577fc7c3ecd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ClassModel.cs @@ -49,6 +49,7 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs index 1e65528d26cc..dcfcc06467ae 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DateOnlyClass.cs @@ -49,6 +49,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateOnlyPropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs index 76e33fbcd2cf..20f34678e8af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/DeprecatedObject.cs @@ -49,6 +49,7 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs index ac96aef36d98..3b5881a47119 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Dog.cs @@ -51,6 +51,7 @@ public Dog(string className, Option breed = default, Option co /// Used to track the state of Breed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BreedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index b57e698f27b9..b848f330b3c2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -55,6 +55,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of MainShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MainShapeOption { get; private set; } /// @@ -67,6 +68,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of Shapes /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ShapesOption { get; private set; } /// @@ -79,6 +81,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of NullableShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableShapeOption { get; private set; } /// @@ -91,6 +94,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of ShapeOrNull /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShapeOrNullOption { get; private set; } /// @@ -248,11 +252,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); if (drawing.MainShapeOption.IsSet) + { writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } if (drawing.ShapesOption.IsSet) + { writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs index 2b70ca9f31dd..664242702ce5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumArrays.cs @@ -183,6 +183,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustSymbolOption { get; private set; } /// @@ -195,6 +196,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of ArrayEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayEnumOption { get; private set; } /// @@ -327,8 +329,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); if (enumArrays.ArrayEnumOption.IsSet) + { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index fe5d3aef86c5..3fd5bdb90e2b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -280,6 +280,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOption { get; private set; } /// @@ -351,6 +352,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOnlyOption { get; private set; } /// @@ -429,6 +431,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumNumberOption { get; private set; } /// @@ -591,6 +594,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumStringOption { get; private set; } /// @@ -603,6 +607,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumDefaultValueOption { get; private set; } /// @@ -615,6 +620,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerOption { get; private set; } /// @@ -627,6 +633,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// @@ -639,6 +646,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs index 48e4008510a5..7a650ad95b0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/File.cs @@ -49,6 +49,7 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SourceURIOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs index 80007f7efb76..b061b4c87faa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FileSchemaTestClass.cs @@ -51,6 +51,7 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of File /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FileOption { get; private set; } /// @@ -63,6 +64,7 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of Files /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> FilesOption { get; private set; } /// @@ -197,11 +199,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); if (fileSchemaTestClass.FileOption.IsSet) + { writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } if (fileSchemaTestClass.FilesOption.IsSet) + { writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs index faf6cada2867..39566c13eaf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Foo.cs @@ -49,6 +49,7 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs index ea91c011b9d5..1bbe0ddf0fe8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FooGetDefaultResponse.cs @@ -49,6 +49,7 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -171,8 +172,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); if (fooGetDefaultResponse.VarStringOption.IsSet) + { writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs index b73edfd78d6a..43006afbbb0f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/FormatTest.cs @@ -110,6 +110,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Binary /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BinaryOption { get; private set; } /// @@ -122,6 +123,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -135,6 +137,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDecimal /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDecimalOption { get; private set; } /// @@ -147,6 +150,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDouble /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDoubleOption { get; private set; } /// @@ -159,6 +163,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarFloat /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarFloatOption { get; private set; } /// @@ -171,6 +176,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int32 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int32Option { get; private set; } /// @@ -183,6 +189,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int64 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int64Option { get; private set; } /// @@ -195,6 +202,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Integer /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerOption { get; private set; } /// @@ -207,6 +215,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithBackslash /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithBackslashOption { get; private set; } /// @@ -220,6 +229,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigits /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsOption { get; private set; } /// @@ -233,6 +243,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// @@ -246,6 +257,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -258,6 +270,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedIntegerOption { get; private set; } /// @@ -270,6 +283,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedLong /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedLongOption { get; private set; } /// @@ -282,6 +296,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -734,14 +749,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteString("password", formatTest.Password); if (formatTest.BinaryOption.IsSet) + { writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } if (formatTest.DateTimeOption.IsSet) writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimalOption.IsSet) + { writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + } if (formatTest.VarDoubleOption.IsSet) writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs index 82d85bae189f..066324fd8ac0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Fruit.cs @@ -72,6 +72,7 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs index ec0243d528e1..ce3104ed3261 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/GmFruit.cs @@ -52,6 +52,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Apple /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AppleOption { get; private set; } /// @@ -63,6 +64,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Banana /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BananaOption { get; private set; } /// @@ -74,6 +76,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs index bd65c2c64c67..75e57fcf4fec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HasOnlyReadOnly.cs @@ -51,6 +51,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -63,6 +64,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Foo /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FooOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs index a07fd2b1ba3f..44988806cfb7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/HealthCheckResult.cs @@ -49,6 +49,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableMessageOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs index 83b717ea65c9..2f75d0bb148a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/List.cs @@ -49,6 +49,7 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123ListOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs index 78cf4904c24b..67cd536b7ba7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/LiteralStringClass.cs @@ -51,6 +51,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of EscapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EscapedLiteralStringOption { get; private set; } /// @@ -63,6 +64,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnescapedLiteralStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs index 9cb9d292fc34..9e9b2b725f53 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MapTest.cs @@ -121,6 +121,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of DirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> DirectMapOption { get; private set; } /// @@ -133,6 +134,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of IndirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> IndirectMapOption { get; private set; } /// @@ -145,6 +147,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of MapMapOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> MapMapOfStringOption { get; private set; } /// @@ -157,6 +160,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of MapOfEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapOfEnumStringOption { get; private set; } /// @@ -315,17 +319,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); if (mapTest.DirectMapOption.IsSet) + { writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } if (mapTest.IndirectMapOption.IsSet) + { writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } if (mapTest.MapMapOfStringOption.IsSet) + { writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } if (mapTest.MapOfEnumStringOption.IsSet) + { writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 8938a22cd971..0bc78f42edec 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -55,6 +55,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -67,6 +68,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Map /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapOption { get; private set; } /// @@ -79,6 +81,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -91,6 +94,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of UuidWithPattern /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidWithPatternOption { get; private set; } /// @@ -255,8 +259,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs index 5c1649330132..6d738cf1d6a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Model200Response.cs @@ -51,6 +51,7 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// @@ -63,6 +64,7 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs index 0df66d12d106..08959d3204cc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ModelClient.cs @@ -49,6 +49,7 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClientOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs index 06fab465d7be..464ad8d4f38d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Name.cs @@ -61,6 +61,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of Property /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PropertyOption { get; private set; } /// @@ -73,6 +74,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of SnakeCase /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SnakeCaseOption { get; } /// @@ -85,6 +87,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of Var123Number /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123NumberOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index b1824933a08a..86c6e2914513 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -71,6 +71,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayItemsNullableOption { get; private set; } /// @@ -83,6 +84,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectItemsNullableOption { get; private set; } /// @@ -95,6 +97,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// @@ -107,6 +110,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayNullablePropOption { get; private set; } /// @@ -119,6 +123,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of BooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BooleanPropOption { get; private set; } /// @@ -131,6 +136,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of DateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatePropOption { get; private set; } /// @@ -143,6 +149,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of DatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatetimePropOption { get; private set; } /// @@ -155,6 +162,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of IntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerPropOption { get; private set; } /// @@ -167,6 +175,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of NumberProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NumberPropOption { get; private set; } /// @@ -179,6 +188,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectAndItemsNullablePropOption { get; private set; } /// @@ -191,6 +201,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectNullablePropOption { get; private set; } /// @@ -203,6 +214,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of StringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StringPropOption { get; private set; } /// @@ -417,11 +429,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); if (nullableClass.ArrayItemsNullableOption.IsSet) + { writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectItemsNullableOption.IsSet) + { writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs index cffa703c2481..4bb7bbfc88c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableGuidClass.cs @@ -49,6 +49,7 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs index 43c62d78f41c..6362c24186d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NumberOnly.cs @@ -49,6 +49,7 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustNumberOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs index c3b898a32636..506fddc846e4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ObjectWithDeprecatedFields.cs @@ -55,6 +55,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> BarsOption { get; private set; } /// @@ -68,6 +69,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeprecatedRefOption { get; private set; } /// @@ -81,6 +83,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -94,6 +97,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -248,11 +252,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); if (objectWithDeprecatedFields.BarsOption.IsSet) + { writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } if (objectWithDeprecatedFields.IdOption.IsSet) writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index d4d5be19d315..b990f5b833ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -140,6 +140,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -153,6 +154,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -165,6 +167,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of PetId /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PetIdOption { get; private set; } /// @@ -177,6 +180,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Quantity /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option QuantityOption { get; private set; } /// @@ -189,6 +193,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of ShipDate /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShipDateOption { get; private set; } /// @@ -202,6 +207,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Complete /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CompleteOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs index 4dbabac4e203..929cfede69a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/OuterComposite.cs @@ -53,6 +53,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyBooleanOption { get; private set; } /// @@ -65,6 +66,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyNumberOption { get; private set; } /// @@ -77,6 +79,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs index 8a94f994361d..2f1abbea3591 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Pet.cs @@ -140,6 +140,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -166,6 +167,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Category /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CategoryOption { get; private set; } /// @@ -178,6 +180,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -190,6 +193,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Tags /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> TagsOption { get; private set; } /// @@ -376,8 +380,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.CategoryOption.IsSet) + { writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } if (pet.IdOption.IsSet) writer.WriteNumber("id", pet.IdOption.Value!.Value); @@ -388,8 +394,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WriteNull("status"); if (pet.TagsOption.IsSet) + { writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs index d1e1ef5dede8..b63c0cbc81e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ReadOnlyFirst.cs @@ -51,6 +51,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -63,6 +64,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Baz /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BazOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs index 4632fedd84f7..5b38fc58828f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -486,6 +486,7 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// @@ -557,6 +558,7 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// @@ -719,6 +721,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// @@ -731,6 +734,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1097,6 +1101,7 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// @@ -1168,6 +1173,7 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// @@ -1333,6 +1339,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumStringOption { get; private set; } /// @@ -1345,6 +1352,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1400,6 +1408,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableDatePropOption { get; private set; } /// @@ -1412,6 +1421,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// @@ -1424,6 +1434,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// @@ -1436,6 +1447,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// @@ -1448,6 +1460,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// @@ -1460,6 +1473,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableStringPropOption { get; private set; } /// @@ -1472,6 +1486,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableUuidOption { get; private set; } /// @@ -1528,6 +1543,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableDatePropOption { get; private set; } /// @@ -1540,6 +1556,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableIntegerPropOption { get; private set; } /// @@ -1552,6 +1569,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } /// @@ -1564,6 +1582,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableBooleanPropOption { get; private set; } /// @@ -1576,6 +1595,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableDatetimePropOption { get; private set; } /// @@ -1588,6 +1608,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableStringPropOption { get; private set; } /// @@ -1600,6 +1621,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableUuidOption { get; private set; } /// @@ -2196,8 +2218,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs index 69892b578d10..3a3bf398ebc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Return.cs @@ -49,6 +49,7 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarReturnOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs index f1c4519c0302..7597e889587e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHash.cs @@ -51,6 +51,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleOption { get; private set; } /// @@ -63,6 +64,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleUuidOption { get; private set; } /// @@ -194,8 +196,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); if (rolesReportsHash.RoleOption.IsSet) + { writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } if (rolesReportsHash.RoleUuidOption.IsSet) writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs index 57d819b866ee..d74e74a0cdbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RolesReportsHashRole.cs @@ -49,6 +49,7 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs index 206826d83872..4ce1e685dc69 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/SpecialModelName.cs @@ -51,6 +51,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarSpecialModelNameOption { get; private set; } /// @@ -63,6 +64,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SpecialPropertyNameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs index fa9ac0352198..a29366ecfa79 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Tag.cs @@ -51,6 +51,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -63,6 +64,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs index 7429b824f680..c253c134a3ac 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordList.cs @@ -49,6 +49,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ValueOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs index a8c31c8f2d96..fe73bc2ded6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestCollectionEndingWithWordListObject.cs @@ -49,6 +49,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> TestCollectionEndingWithWordListOption { get; private set; } /// @@ -171,8 +172,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index ffbca2de0460..3c5aea9665a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -49,6 +49,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option somePropert /// Used to track the state of SomeProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SomePropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 28d324b1afae..9de7d2a95683 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -71,6 +71,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Email /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmailOption { get; private set; } /// @@ -83,6 +84,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of FirstName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FirstNameOption { get; private set; } /// @@ -95,6 +97,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -107,6 +110,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of LastName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LastNameOption { get; private set; } /// @@ -119,6 +123,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// @@ -132,6 +137,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Password /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PasswordOption { get; private set; } /// @@ -144,6 +150,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Phone /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PhoneOption { get; private set; } /// @@ -156,6 +163,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of UserStatus /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UserStatusOption { get; private set; } /// @@ -169,6 +177,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Username /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UsernameOption { get; private set; } /// @@ -181,6 +190,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of AnyTypeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropOption { get; private set; } /// @@ -194,6 +204,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropNullableOption { get; private set; } /// @@ -207,6 +218,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// @@ -444,8 +456,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("lastName", user.LastName); if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs index f437211ac79c..40f40250f504 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Whale.cs @@ -59,6 +59,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasBaleen /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasBaleenOption { get; private set; } /// @@ -71,6 +72,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasTeeth /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasTeethOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs index eb95726cd125..5e5d680c221a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Zebra.cs @@ -131,6 +131,7 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs index e4728c61db00..57bf9caf9695 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/ZeroBasedEnumClass.cs @@ -115,6 +115,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ZeroBasedEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs index 41c0285d0baa..c96ec917c52b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Activity.cs @@ -48,6 +48,7 @@ public Activity(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ActivityOutputsOption { get; private set; } /// @@ -170,8 +171,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); if (activity.ActivityOutputsOption.IsSet) + { writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index ddeb9eb9bae5..78bdf9d3abaf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -50,6 +50,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop1 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop1Option { get; private set; } /// @@ -62,6 +63,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Opti /// Used to track the state of Prop2 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop2Option { get; private set; } /// @@ -198,8 +200,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); if (activityOutputElementRepresentation.Prop2Option.IsSet) + { writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 189128f9c80d..bb63ed9b07d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -62,6 +62,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmptyMapOption { get; private set; } /// @@ -75,6 +76,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> MapOfMapPropertyOption { get; private set; } /// @@ -87,6 +89,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapPropertyOption { get; private set; } /// @@ -99,6 +102,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// @@ -111,6 +115,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// @@ -123,6 +128,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// @@ -135,6 +141,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapWithUndeclaredPropertiesStringOption { get; private set; } /// @@ -147,6 +154,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Anytype1Option { get; private set; } /// @@ -347,26 +355,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); if (additionalPropertiesClass.EmptyMapOption.IsSet) + { writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapPropertyOption.IsSet) + { writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs index 08bc7e962c01..10b1c44a8c08 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Animal.cs @@ -56,6 +56,7 @@ public Animal(string className, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs index 7f441f4d366d..844d79e43e18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -52,6 +52,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Code /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CodeOption { get; private set; } /// @@ -64,6 +65,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Message /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MessageOption { get; private set; } /// @@ -76,6 +78,7 @@ public ApiResponse(Option code = default, Option message = defaul /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs index c22fe306b31a..d50ea4406a00 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Apple.cs @@ -52,6 +52,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of ColorCode /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorCodeOption { get; private set; } /// @@ -64,6 +65,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of Cultivar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CultivarOption { get; private set; } /// @@ -76,6 +78,7 @@ public Apple(Option colorCode = default, Option cultivar = def /// Used to track the state of Origin /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OriginOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs index 142f0b1518e6..0fb31ae31859 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AppleReq.cs @@ -56,6 +56,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Used to track the state of Mealy /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MealyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 0e0ba0f16e5e..c723d43d16c8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -48,6 +48,7 @@ public ArrayOfArrayOfNumberOnly(Option>?> arrayArrayNumber = /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayNumberOption { get; private set; } /// @@ -170,8 +171,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index 8e98d4ae0670..f1929407e896 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -48,6 +48,7 @@ public ArrayOfNumberOnly(Option?> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayNumberOption { get; private set; } /// @@ -170,8 +171,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs index 93897f864e51..f6ecfbb72d66 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -52,6 +52,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayOfIntegerOption { get; private set; } /// @@ -64,6 +65,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> ArrayArrayOfModelOption { get; private set; } /// @@ -76,6 +78,7 @@ public ArrayTest(Option>?> arrayArrayOfInteger = default, Option /// Used to track the state of ArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayOfStringOption { get; private set; } /// @@ -222,14 +225,20 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } if (arrayTest.ArrayArrayOfModelOption.IsSet) + { writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } if (arrayTest.ArrayOfStringOption.IsSet) + { writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs index a73d3d129d9e..de17f0c93875 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Banana.cs @@ -48,6 +48,7 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LengthCmOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs index ba5c1b900cf4..399687d74f0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/BananaReq.cs @@ -56,6 +56,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Used to track the state of Sweet /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SweetOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs index a107c08899a5..d2cbece80d4f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Capitalization.cs @@ -58,6 +58,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of ATT_NAME /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ATT_NAMEOption { get; private set; } /// @@ -71,6 +72,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of CapitalCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalCamelOption { get; private set; } /// @@ -83,6 +85,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of CapitalSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalSnakeOption { get; private set; } /// @@ -95,6 +98,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SCAETHFlowPointsOption { get; private set; } /// @@ -107,6 +111,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SmallCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallCamelOption { get; private set; } /// @@ -119,6 +124,7 @@ public Capitalization(Option aTTNAME = default, Option capital /// Used to track the state of SmallSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallSnakeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index d38c8e9bdca9..b9b7df79bd3f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -50,6 +50,7 @@ public Cat(string className, Option declawed = default, Option c /// Used to track the state of Declawed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeclawedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 244bbfa01bac..1050f942fdf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -56,6 +56,7 @@ public Category(string name = @"default-name", Option id = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs index 033bc5d0ef97..123bbee80124 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ChildCat.cs @@ -102,6 +102,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public new Option PetTypeOption { get; private set; } /// @@ -114,6 +115,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs index 40d67209d497..995f04192dc0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ClassModel.cs @@ -48,6 +48,7 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs index adefb2a40ecb..ee5fb40abb31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -48,6 +48,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateOnlyPropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 617ddf0e7b28..77dea9cffa72 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -48,6 +48,7 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs index 202aec314630..7891f26505a3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Dog.cs @@ -50,6 +50,7 @@ public Dog(string className, Option breed = default, Option co /// Used to track the state of Breed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BreedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 4694be7eae63..47a2babf5c12 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -54,6 +54,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of MainShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MainShapeOption { get; private set; } /// @@ -66,6 +67,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of Shapes /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ShapesOption { get; private set; } /// @@ -78,6 +80,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of NullableShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableShapeOption { get; private set; } /// @@ -90,6 +93,7 @@ public Drawing(Option mainShape = default, Option?> shapes = /// Used to track the state of ShapeOrNull /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShapeOrNullOption { get; private set; } /// @@ -247,11 +251,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); if (drawing.MainShapeOption.IsSet) + { writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } if (drawing.ShapesOption.IsSet) + { writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs index 6a1110d6d05f..4347dd974535 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -182,6 +182,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustSymbolOption { get; private set; } /// @@ -194,6 +195,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of ArrayEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayEnumOption { get; private set; } /// @@ -326,8 +328,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); if (enumArrays.ArrayEnumOption.IsSet) + { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value!.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index 8b8202a81e9e..facd29905472 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -279,6 +279,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOption { get; private set; } /// @@ -350,6 +351,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOnlyOption { get; private set; } /// @@ -428,6 +430,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumNumberOption { get; private set; } /// @@ -590,6 +593,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumStringOption { get; private set; } /// @@ -602,6 +606,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumDefaultValueOption { get; private set; } /// @@ -614,6 +619,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerOption { get; private set; } /// @@ -626,6 +632,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// @@ -638,6 +645,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs index a3c25e333231..84bcc677147c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/File.cs @@ -48,6 +48,7 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SourceURIOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index f340318cd6b6..8791b3498ae4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -50,6 +50,7 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of File /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FileOption { get; private set; } /// @@ -62,6 +63,7 @@ public FileSchemaTestClass(Option file = default, Option?> fil /// Used to track the state of Files /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> FilesOption { get; private set; } /// @@ -196,11 +198,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); if (fileSchemaTestClass.FileOption.IsSet) + { writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } if (fileSchemaTestClass.FilesOption.IsSet) + { writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs index e7a91d642c5c..85d6ba28af34 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Foo.cs @@ -48,6 +48,7 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 73a827b3d6cb..09e11f0babbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -48,6 +48,7 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -170,8 +171,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); if (fooGetDefaultResponse.VarStringOption.IsSet) + { writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs index 2a9d809236a5..5a8af6da0de0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/FormatTest.cs @@ -109,6 +109,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Binary /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BinaryOption { get; private set; } /// @@ -121,6 +122,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -134,6 +136,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDecimal /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDecimalOption { get; private set; } /// @@ -146,6 +149,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDouble /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDoubleOption { get; private set; } /// @@ -158,6 +162,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarFloat /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarFloatOption { get; private set; } /// @@ -170,6 +175,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int32 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int32Option { get; private set; } /// @@ -182,6 +188,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int64 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int64Option { get; private set; } /// @@ -194,6 +201,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Integer /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerOption { get; private set; } /// @@ -206,6 +214,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithBackslash /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithBackslashOption { get; private set; } /// @@ -219,6 +228,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigits /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsOption { get; private set; } /// @@ -232,6 +242,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// @@ -245,6 +256,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -257,6 +269,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedIntegerOption { get; private set; } /// @@ -269,6 +282,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedLong /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedLongOption { get; private set; } /// @@ -281,6 +295,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -733,14 +748,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteString("password", formatTest.Password); if (formatTest.BinaryOption.IsSet) + { writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } if (formatTest.DateTimeOption.IsSet) writer.WriteString("dateTime", formatTest.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimalOption.IsSet) + { writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + } if (formatTest.VarDoubleOption.IsSet) writer.WriteNumber("double", formatTest.VarDoubleOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs index 06a7ad5d5d82..ebb0d41f7201 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Fruit.cs @@ -71,6 +71,7 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs index b06867bb623a..0170c34db96b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/GmFruit.cs @@ -51,6 +51,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Apple /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AppleOption { get; private set; } /// @@ -62,6 +63,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Banana /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BananaOption { get; private set; } /// @@ -73,6 +75,7 @@ public GmFruit(Option apple, Option banana, Option col /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index 005bc0c1da78..e9fac6f25e52 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -50,6 +50,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -62,6 +63,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = de /// Used to track the state of Foo /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FooOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs index bea03f780087..e95d79fee9dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -48,6 +48,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableMessageOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs index c05bc6ebc004..a14d5e9973bd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/List.cs @@ -48,6 +48,7 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123ListOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 8aabb072d612..639e2b6c76df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -50,6 +50,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of EscapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EscapedLiteralStringOption { get; private set; } /// @@ -62,6 +63,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnescapedLiteralStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs index aa1fa8f7b2f6..e5303dbc7889 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MapTest.cs @@ -120,6 +120,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of DirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> DirectMapOption { get; private set; } /// @@ -132,6 +133,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of IndirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> IndirectMapOption { get; private set; } /// @@ -144,6 +146,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of MapMapOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>?> MapMapOfStringOption { get; private set; } /// @@ -156,6 +159,7 @@ public static string InnerEnumToJsonValue(InnerEnum? value) /// Used to track the state of MapOfEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapOfEnumStringOption { get; private set; } /// @@ -314,17 +318,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); if (mapTest.DirectMapOption.IsSet) + { writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } if (mapTest.IndirectMapOption.IsSet) + { writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } if (mapTest.MapMapOfStringOption.IsSet) + { writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } if (mapTest.MapOfEnumStringOption.IsSet) + { writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index 49785c2d53c9..f8d1ff8356a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -54,6 +54,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -66,6 +67,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Map /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> MapOption { get; private set; } /// @@ -78,6 +80,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -90,6 +93,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of UuidWithPattern /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidWithPatternOption { get; private set; } /// @@ -254,8 +258,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value!.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs index 74b68e721d9f..42e64ef20547 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Model200Response.cs @@ -50,6 +50,7 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// @@ -62,6 +63,7 @@ public Model200Response(Option varClass = default, Option name = /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs index 429dd896ef32..361969069055 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ModelClient.cs @@ -48,6 +48,7 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClientOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs index 6db71db5a360..91afe1999fcd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Name.cs @@ -60,6 +60,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of Property /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PropertyOption { get; private set; } /// @@ -72,6 +73,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of SnakeCase /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SnakeCaseOption { get; } /// @@ -84,6 +86,7 @@ public Name(int varName, Option property = default, Option snakeC /// Used to track the state of Var123Number /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123NumberOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 54fae9389232..29883550a98e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -70,6 +70,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayItemsNullableOption { get; private set; } /// @@ -82,6 +83,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectItemsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectItemsNullableOption { get; private set; } /// @@ -94,6 +96,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// @@ -106,6 +109,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ArrayNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ArrayNullablePropOption { get; private set; } /// @@ -118,6 +122,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of BooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BooleanPropOption { get; private set; } /// @@ -130,6 +135,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of DateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatePropOption { get; private set; } /// @@ -142,6 +148,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of DatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatetimePropOption { get; private set; } /// @@ -154,6 +161,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of IntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerPropOption { get; private set; } /// @@ -166,6 +174,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of NumberProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NumberPropOption { get; private set; } /// @@ -178,6 +187,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectAndItemsNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectAndItemsNullablePropOption { get; private set; } /// @@ -190,6 +200,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of ObjectNullableProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ObjectNullablePropOption { get; private set; } /// @@ -202,6 +213,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< /// Used to track the state of StringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StringPropOption { get; private set; } /// @@ -416,11 +428,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); if (nullableClass.ArrayItemsNullableOption.IsSet) + { writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectItemsNullableOption.IsSet) + { writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs index 9134874441c1..a2e4d0f271f9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -48,6 +48,7 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs index 5a7c5a172555..4692869f6193 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -48,6 +48,7 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustNumberOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index d027881a4e34..6b6087eefac0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -54,6 +54,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> BarsOption { get; private set; } /// @@ -67,6 +68,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeprecatedRefOption { get; private set; } /// @@ -80,6 +82,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -93,6 +96,7 @@ public ObjectWithDeprecatedFields(Option?> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -247,11 +251,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); if (objectWithDeprecatedFields.BarsOption.IsSet) + { writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } if (objectWithDeprecatedFields.IdOption.IsSet) writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index e9034545ad8d..29c2446d9494 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -139,6 +139,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -152,6 +153,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -164,6 +166,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of PetId /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PetIdOption { get; private set; } /// @@ -176,6 +179,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Quantity /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option QuantityOption { get; private set; } /// @@ -188,6 +192,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of ShipDate /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShipDateOption { get; private set; } /// @@ -201,6 +206,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Complete /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CompleteOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs index 1357183a90c5..06993578e15f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -52,6 +52,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyBooleanOption { get; private set; } /// @@ -64,6 +65,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyNumberOption { get; private set; } /// @@ -76,6 +78,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs index 6065c8956ac3..f1381bcc8779 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Pet.cs @@ -139,6 +139,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -165,6 +166,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Category /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CategoryOption { get; private set; } /// @@ -177,6 +179,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -189,6 +192,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Tags /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> TagsOption { get; private set; } /// @@ -375,8 +379,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.CategoryOption.IsSet) + { writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } if (pet.IdOption.IsSet) writer.WriteNumber("id", pet.IdOption.Value!.Value); @@ -387,8 +393,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WriteNull("status"); if (pet.TagsOption.IsSet) + { writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index a0386a20ae96..945d3a77f611 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -50,6 +50,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -62,6 +63,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = defaul /// Used to track the state of Baz /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BazOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index c05f3fc4a077..81f473a03e21 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -485,6 +485,7 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// @@ -556,6 +557,7 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// @@ -718,6 +720,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// @@ -730,6 +733,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1096,6 +1100,7 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// @@ -1167,6 +1172,7 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// @@ -1332,6 +1338,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumStringOption { get; private set; } /// @@ -1344,6 +1351,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1399,6 +1407,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableDatePropOption { get; private set; } /// @@ -1411,6 +1420,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// @@ -1423,6 +1433,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// @@ -1435,6 +1446,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// @@ -1447,6 +1459,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// @@ -1459,6 +1472,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableStringPropOption { get; private set; } /// @@ -1471,6 +1485,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableUuidOption { get; private set; } /// @@ -1527,6 +1542,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableDatePropOption { get; private set; } /// @@ -1539,6 +1555,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableIntegerPropOption { get; private set; } /// @@ -1551,6 +1568,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> NotrequiredNullableArrayOfStringOption { get; private set; } /// @@ -1563,6 +1581,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableBooleanPropOption { get; private set; } /// @@ -1575,6 +1594,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableDatetimePropOption { get; private set; } /// @@ -1587,6 +1607,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableStringPropOption { get; private set; } /// @@ -1599,6 +1620,7 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableUuidOption { get; private set; } /// @@ -2195,8 +2217,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs index c458446ead1d..5449201bcf15 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Return.cs @@ -48,6 +48,7 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarReturnOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs index a3d47d1fe672..0a00cf07fd74 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -50,6 +50,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleOption { get; private set; } /// @@ -62,6 +63,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleUuidOption { get; private set; } /// @@ -193,8 +195,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); if (rolesReportsHash.RoleOption.IsSet) + { writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } if (rolesReportsHash.RoleUuidOption.IsSet) writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value!.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index 4f87bbbfea38..51616042599a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -48,6 +48,7 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs index cd382f12d5bc..e627c778abcd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -50,6 +50,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarSpecialModelNameOption { get; private set; } /// @@ -62,6 +63,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SpecialPropertyNameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs index d50223cb2785..a8f5a1b30082 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Tag.cs @@ -50,6 +50,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -62,6 +63,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index c6e694610c28..e98384c82055 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -48,6 +48,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ValueOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 33d488bef177..75005fd9bf78 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -48,6 +48,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> TestCollectionEndingWithWordListOption { get; private set; } /// @@ -170,8 +171,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index ef001ea5c3f6..68f5aee3c682 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -48,6 +48,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option somePropert /// Used to track the state of SomeProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SomePropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 69039652565e..5e7874cc86ab 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -70,6 +70,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Email /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmailOption { get; private set; } /// @@ -82,6 +83,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of FirstName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FirstNameOption { get; private set; } /// @@ -94,6 +96,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -106,6 +109,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of LastName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LastNameOption { get; private set; } /// @@ -118,6 +122,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// @@ -131,6 +136,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Password /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PasswordOption { get; private set; } /// @@ -143,6 +149,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Phone /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PhoneOption { get; private set; } /// @@ -155,6 +162,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of UserStatus /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UserStatusOption { get; private set; } /// @@ -168,6 +176,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of Username /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UsernameOption { get; private set; } /// @@ -180,6 +189,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of AnyTypeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropOption { get; private set; } /// @@ -193,6 +203,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropNullableOption { get; private set; } /// @@ -206,6 +217,7 @@ public User(Option email = default, Option firstName = default /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// @@ -443,8 +455,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("lastName", user.LastName); if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs index 9950a0bdc194..00aeea839e66 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Whale.cs @@ -58,6 +58,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasBaleen /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasBaleenOption { get; private set; } /// @@ -70,6 +71,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasTeeth /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasTeethOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs index 7844dc6335cd..f009907a9d17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Zebra.cs @@ -130,6 +130,7 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 23abfb31bf3f..c7083ab9d5b1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -114,6 +114,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ZeroBasedEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs index 4c4b7e6e697a..141338516205 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Activity.cs @@ -46,6 +46,7 @@ public Activity(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ActivityOutputsOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); if (activity.ActivityOutputsOption.IsSet) + { writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index 7fb0642c8000..da158a14e414 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -48,6 +48,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop1 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop1Option { get; private set; } /// @@ -60,6 +61,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop2 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop2Option { get; private set; } /// @@ -196,8 +198,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); if (activityOutputElementRepresentation.Prop2Option.IsSet) + { writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 5c6d6080444a..9de2ee269436 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -60,6 +60,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmptyMapOption { get; private set; } /// @@ -73,6 +74,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> MapOfMapPropertyOption { get; private set; } /// @@ -85,6 +87,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapPropertyOption { get; private set; } /// @@ -97,6 +100,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// @@ -109,6 +113,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// @@ -121,6 +126,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// @@ -133,6 +139,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } /// @@ -145,6 +152,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Anytype1Option { get; private set; } /// @@ -345,26 +353,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); if (additionalPropertiesClass.EmptyMapOption.IsSet) + { writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapPropertyOption.IsSet) + { writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs index de2c9fad7b12..82333f58eb64 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Animal.cs @@ -54,6 +54,7 @@ public Animal(string className, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs index d9c08e85ac84..eebfe2c75161 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -50,6 +50,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Code /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CodeOption { get; private set; } /// @@ -62,6 +63,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Message /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MessageOption { get; private set; } /// @@ -74,6 +76,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs index 0a7e8d15b04c..a349e6c9d16c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Apple.cs @@ -50,6 +50,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of ColorCode /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorCodeOption { get; private set; } /// @@ -62,6 +63,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of Cultivar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CultivarOption { get; private set; } /// @@ -74,6 +76,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of Origin /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OriginOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs index e8682a7be3fb..6bf9766e93c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -54,6 +54,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Used to track the state of Mealy /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MealyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index dab704b88f64..b18638bb4e18 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -46,6 +46,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayNumberOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index ef15a2678e13..4b9756fa3638 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -46,6 +46,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayNumberOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 7132885ebf47..0bb57876ce1a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -50,6 +50,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayOfIntegerOption { get; private set; } /// @@ -62,6 +63,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayOfModelOption { get; private set; } /// @@ -74,6 +76,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayOfStringOption { get; private set; } /// @@ -220,14 +223,20 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } if (arrayTest.ArrayArrayOfModelOption.IsSet) + { writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } if (arrayTest.ArrayOfStringOption.IsSet) + { writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs index a7591df666bc..bb644ada329d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Banana.cs @@ -46,6 +46,7 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LengthCmOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs index f796812969ec..a7eb2c945be1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -54,6 +54,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Used to track the state of Sweet /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SweetOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs index f2a97bef03a0..46859603bd17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -56,6 +56,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of ATT_NAME /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ATT_NAMEOption { get; private set; } /// @@ -69,6 +70,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of CapitalCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalCamelOption { get; private set; } /// @@ -81,6 +83,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of CapitalSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalSnakeOption { get; private set; } /// @@ -93,6 +96,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SCAETHFlowPointsOption { get; private set; } /// @@ -105,6 +109,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SmallCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallCamelOption { get; private set; } /// @@ -117,6 +122,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SmallSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallSnakeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index 3dce21bf6471..b5561b513756 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -48,6 +48,7 @@ public Cat(string className, Option declawed = default, Option co /// Used to track the state of Declawed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeclawedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index c6dfc5f5cd39..e8727e9633b9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -54,6 +54,7 @@ public Category(string name = @"default-name", Option id = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs index 97ac270d0da8..b10f05b2a5a2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -100,6 +100,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public new Option PetTypeOption { get; private set; } /// @@ -112,6 +113,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs index 98773d0f2550..bbed8f0df133 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -46,6 +46,7 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 4a83b416b2f4..9b8aeb67815f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -46,6 +46,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateOnlyPropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 07281cc492a0..6f0315de5d5a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -46,6 +46,7 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs index b9020ff75ecc..1d53127161c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Dog.cs @@ -48,6 +48,7 @@ public Dog(string className, Option breed = default, Option colo /// Used to track the state of Breed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BreedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index 7063c123aa98..eaa8adb03e81 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -52,6 +52,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of MainShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MainShapeOption { get; private set; } /// @@ -64,6 +65,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of Shapes /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ShapesOption { get; private set; } /// @@ -76,6 +78,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of NullableShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableShapeOption { get; private set; } /// @@ -88,6 +91,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of ShapeOrNull /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShapeOrNullOption { get; private set; } /// @@ -245,11 +249,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); if (drawing.MainShapeOption.IsSet) + { writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } if (drawing.ShapesOption.IsSet) + { writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs index e33388496f57..44ebb6856cbe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -180,6 +180,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustSymbolOption { get; private set; } /// @@ -192,6 +193,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of ArrayEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 8863bc0cc6ce..5be59457227e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -277,6 +277,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOption { get; private set; } /// @@ -348,6 +349,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOnlyOption { get; private set; } /// @@ -426,6 +428,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumNumberOption { get; private set; } /// @@ -588,6 +591,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumStringOption { get; private set; } /// @@ -600,6 +604,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumDefaultValueOption { get; private set; } /// @@ -612,6 +617,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerOption { get; private set; } /// @@ -624,6 +630,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// @@ -636,6 +643,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs index f935a8c9a920..11754d379993 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/File.cs @@ -46,6 +46,7 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SourceURIOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index a83672dc1d63..6a07c6d1f950 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -48,6 +48,7 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of File /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FileOption { get; private set; } /// @@ -60,6 +61,7 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of Files /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> FilesOption { get; private set; } /// @@ -194,11 +196,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); if (fileSchemaTestClass.FileOption.IsSet) + { writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } if (fileSchemaTestClass.FilesOption.IsSet) + { writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs index ca6b4f74b0bf..98f8d13300ad 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Foo.cs @@ -46,6 +46,7 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index df5273b29e40..5834385cd5bb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -46,6 +46,7 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); if (fooGetDefaultResponse.VarStringOption.IsSet) + { writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs index 543b540f7860..ccf7c37ed7cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -107,6 +107,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Binary /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BinaryOption { get; private set; } /// @@ -119,6 +120,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -132,6 +134,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDecimal /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDecimalOption { get; private set; } /// @@ -144,6 +147,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDouble /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDoubleOption { get; private set; } /// @@ -156,6 +160,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarFloat /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarFloatOption { get; private set; } /// @@ -168,6 +173,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int32 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int32Option { get; private set; } /// @@ -180,6 +186,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int64 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int64Option { get; private set; } /// @@ -192,6 +199,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Integer /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerOption { get; private set; } /// @@ -204,6 +212,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithBackslash /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithBackslashOption { get; private set; } /// @@ -217,6 +226,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigits /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsOption { get; private set; } /// @@ -230,6 +240,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// @@ -243,6 +254,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -255,6 +267,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedIntegerOption { get; private set; } /// @@ -267,6 +280,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedLong /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedLongOption { get; private set; } /// @@ -279,6 +293,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -731,14 +746,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteString("password", formatTest.Password); if (formatTest.BinaryOption.IsSet) + { writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } if (formatTest.DateTimeOption.IsSet) writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimalOption.IsSet) + { writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + } if (formatTest.VarDoubleOption.IsSet) writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs index 56babaeafe4b..ea23d8efc424 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -69,6 +69,7 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs index 75b6c0bb7af2..fc6e5a9a4574 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -49,6 +49,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AppleOption { get; private set; } /// @@ -60,6 +61,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Banana /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BananaOption { get; private set; } /// @@ -71,6 +73,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index ea29e35293ae..9652b767d130 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -48,6 +48,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -60,6 +61,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Foo /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FooOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 1d0eac7201d1..4931d3d73fe5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -46,6 +46,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableMessageOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs index e8d6aacdebba..5d0425e77695 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/List.cs @@ -46,6 +46,7 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123ListOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index c6e49ac7068f..f5e9d77e61c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -48,6 +48,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of EscapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EscapedLiteralStringOption { get; private set; } /// @@ -60,6 +61,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnescapedLiteralStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs index 2c4fbfaa7650..0459a633accb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -118,6 +118,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of DirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> DirectMapOption { get; private set; } /// @@ -130,6 +131,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of IndirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> IndirectMapOption { get; private set; } /// @@ -142,6 +144,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of MapMapOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> MapMapOfStringOption { get; private set; } /// @@ -154,6 +157,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of MapOfEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapOfEnumStringOption { get; private set; } /// @@ -312,17 +316,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); if (mapTest.DirectMapOption.IsSet) + { writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } if (mapTest.IndirectMapOption.IsSet) + { writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } if (mapTest.MapMapOfStringOption.IsSet) + { writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } if (mapTest.MapOfEnumStringOption.IsSet) + { writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index d71a2c249bcb..99d8e1c2fffe 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -52,6 +52,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -64,6 +65,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Map /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapOption { get; private set; } /// @@ -76,6 +78,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -88,6 +91,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of UuidWithPattern /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidWithPatternOption { get; private set; } /// @@ -252,8 +256,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs index db34a8e96bf4..5defbb2c2fda 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -48,6 +48,7 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// @@ -60,6 +61,7 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs index b656dcc7dd76..7a2677d7e7f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -46,6 +46,7 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClientOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs index 97cf771d1141..4651bf76c2ce 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Name.cs @@ -58,6 +58,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of Property /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PropertyOption { get; private set; } /// @@ -70,6 +71,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of SnakeCase /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SnakeCaseOption { get; } /// @@ -82,6 +84,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of Var123Number /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123NumberOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 4780e3a4093e..005ffef2791e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -68,6 +68,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayItemsNullableOption { get; private set; } /// @@ -80,6 +81,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectItemsNullableOption { get; private set; } /// @@ -92,6 +94,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayAndItemsNullablePropOption { get; private set; } /// @@ -104,6 +107,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayNullablePropOption { get; private set; } /// @@ -116,6 +120,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BooleanPropOption { get; private set; } /// @@ -128,6 +133,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatePropOption { get; private set; } /// @@ -140,6 +146,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatetimePropOption { get; private set; } /// @@ -152,6 +159,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerPropOption { get; private set; } /// @@ -164,6 +172,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NumberPropOption { get; private set; } /// @@ -176,6 +185,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectAndItemsNullablePropOption { get; private set; } /// @@ -188,6 +198,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectNullablePropOption { get; private set; } /// @@ -200,6 +211,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StringPropOption { get; private set; } /// @@ -414,11 +426,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); if (nullableClass.ArrayItemsNullableOption.IsSet) + { writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectItemsNullableOption.IsSet) + { writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index e0a01b485848..ca650f0cce00 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -46,6 +46,7 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs index 86945bd858d8..6f89d8278430 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -46,6 +46,7 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustNumberOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index be79d8d45d3f..4ea953e572f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -52,6 +52,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> BarsOption { get; private set; } /// @@ -65,6 +66,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeprecatedRefOption { get; private set; } /// @@ -78,6 +80,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -91,6 +94,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -245,11 +249,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); if (objectWithDeprecatedFields.BarsOption.IsSet) + { writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } if (objectWithDeprecatedFields.IdOption.IsSet) writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index c53b3b870d53..280ecf8785e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -137,6 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -150,6 +151,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -162,6 +164,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of PetId /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PetIdOption { get; private set; } /// @@ -174,6 +177,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Quantity /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option QuantityOption { get; private set; } /// @@ -186,6 +190,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of ShipDate /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShipDateOption { get; private set; } /// @@ -199,6 +204,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Complete /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CompleteOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 87f0cdad335a..532010be421c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -50,6 +50,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyBooleanOption { get; private set; } /// @@ -62,6 +63,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyNumberOption { get; private set; } /// @@ -74,6 +76,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs index 464c517b575e..f9e7d0466b2b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Pet.cs @@ -137,6 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -163,6 +164,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Category /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CategoryOption { get; private set; } /// @@ -175,6 +177,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -187,6 +190,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Tags /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> TagsOption { get; private set; } /// @@ -373,8 +377,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.CategoryOption.IsSet) + { writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } if (pet.IdOption.IsSet) writer.WriteNumber("id", pet.IdOption.Value.Value); @@ -385,8 +391,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WriteNull("status"); if (pet.TagsOption.IsSet) + { writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index 4880e135b807..16f308cad5f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -48,6 +48,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -60,6 +61,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Baz /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BazOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 7a0ee42e5336..7f3725be0373 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -483,6 +483,7 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// @@ -554,6 +555,7 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// @@ -716,6 +718,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// @@ -728,6 +731,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1094,6 +1098,7 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// @@ -1165,6 +1170,7 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// @@ -1330,6 +1336,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumStringOption { get; private set; } /// @@ -1342,6 +1349,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1397,6 +1405,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableDatePropOption { get; private set; } /// @@ -1409,6 +1418,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// @@ -1421,6 +1431,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// @@ -1433,6 +1444,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// @@ -1445,6 +1457,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// @@ -1457,6 +1470,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableStringPropOption { get; private set; } /// @@ -1469,6 +1483,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableUuidOption { get; private set; } /// @@ -1525,6 +1540,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableDatePropOption { get; private set; } /// @@ -1537,6 +1553,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableIntegerPropOption { get; private set; } /// @@ -1549,6 +1566,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> NotrequiredNullableArrayOfStringOption { get; private set; } /// @@ -1561,6 +1579,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableBooleanPropOption { get; private set; } /// @@ -1573,6 +1592,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableDatetimePropOption { get; private set; } /// @@ -1585,6 +1605,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableStringPropOption { get; private set; } /// @@ -1597,6 +1618,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableUuidOption { get; private set; } /// @@ -2193,8 +2215,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs index f1f9f795f99a..604c4abd4e06 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Return.cs @@ -46,6 +46,7 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarReturnOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 5cfcd6ecc998..b5b205f69914 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -48,6 +48,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleOption { get; private set; } /// @@ -60,6 +61,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleUuidOption { get; private set; } /// @@ -191,8 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); if (rolesReportsHash.RoleOption.IsSet) + { writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } if (rolesReportsHash.RoleUuidOption.IsSet) writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index b89398c84518..7fa32c72ce29 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -46,6 +46,7 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 41c18257a9dc..419b6a022a8f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -48,6 +48,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarSpecialModelNameOption { get; private set; } /// @@ -60,6 +61,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SpecialPropertyNameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs index dd7cba60a978..418d24e6f1cf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Tag.cs @@ -48,6 +48,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -60,6 +61,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index fc98c8364bef..4a89db3e4ee6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -46,6 +46,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ValueOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index ab5e7ee33849..7479f313811a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -46,6 +46,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> TestCollectionEndingWithWordListOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index abee3c8e1bee..609714542622 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -46,6 +46,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Used to track the state of SomeProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SomePropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index e7c66ae29a42..e4bd370798b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -68,6 +68,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Email /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmailOption { get; private set; } /// @@ -80,6 +81,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of FirstName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FirstNameOption { get; private set; } /// @@ -92,6 +94,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -104,6 +107,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of LastName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LastNameOption { get; private set; } /// @@ -116,6 +120,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// @@ -129,6 +134,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Password /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PasswordOption { get; private set; } /// @@ -141,6 +147,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Phone /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PhoneOption { get; private set; } /// @@ -153,6 +160,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of UserStatus /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UserStatusOption { get; private set; } /// @@ -166,6 +174,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Username /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UsernameOption { get; private set; } /// @@ -178,6 +187,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of AnyTypeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropOption { get; private set; } /// @@ -191,6 +201,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropNullableOption { get; private set; } /// @@ -204,6 +215,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// @@ -441,8 +453,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("lastName", user.LastName); if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs index 5592ec84cd82..1759ab6d1cc7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Whale.cs @@ -56,6 +56,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasBaleen /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasBaleenOption { get; private set; } /// @@ -68,6 +69,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasTeeth /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasTeethOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs index 1af781019d59..013974624458 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -128,6 +128,7 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 3efd4c639fb5..3aa6583fff60 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -112,6 +112,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ZeroBasedEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs index 67b118519c6c..8367b1a64173 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Adult.cs @@ -51,6 +51,7 @@ public Adult(Option?> children = default, Option firstName /// Used to track the state of Children /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option?> ChildrenOption { get; private set; } /// @@ -187,8 +188,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Adult adult, JsonSerializ throw new ArgumentNullException(nameof(adult.Type), "Property is required for class Adult."); if (adult.ChildrenOption.IsSet) + { writer.WritePropertyName("children"); JsonSerializer.Serialize(writer, adult.Children, jsonSerializerOptions); + } if (adult.FirstNameOption.IsSet) writer.WriteString("firstName", adult.FirstName); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs index 70431b4b0c88..dc6b12799fb0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Child.cs @@ -53,6 +53,7 @@ public Child(Option age = default, Option firstName = default, Op /// Used to track the state of Age /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AgeOption { get; private set; } /// @@ -65,6 +66,7 @@ public Child(Option age = default, Option firstName = default, Op /// Used to track the state of BoosterSeat /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BoosterSeatOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs index a47fc8de7704..c45a0eb62d17 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-allOf/src/Org.OpenAPITools/Model/Person.cs @@ -52,6 +52,7 @@ public Person(Option firstName = default, Option lastName = de /// Used to track the state of FirstName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FirstNameOption { get; private set; } /// @@ -64,6 +65,7 @@ public Person(Option firstName = default, Option lastName = de /// Used to track the state of LastName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LastNameOption { get; private set; } /// @@ -76,6 +78,7 @@ public Person(Option firstName = default, Option lastName = de /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs index b9ffd13416a9..22cf086e0e3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Apple.cs @@ -48,6 +48,7 @@ public Apple(Option kind = default) /// Used to track the state of Kind /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option KindOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs index 583e86cb7bf5..9d81d60d111c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Banana.cs @@ -48,6 +48,7 @@ public Banana(Option count = default) /// Used to track the state of Count /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CountOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs index 0e913217083c..a0f5762ac114 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-anyOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -51,6 +51,7 @@ public Fruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AppleOption { get; private set; } /// @@ -62,6 +63,7 @@ public Fruit(Option apple, Option banana, Option color /// Used to track the state of Banana /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BananaOption { get; private set; } /// @@ -73,6 +75,7 @@ public Fruit(Option apple, Option banana, Option color /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs index b9ffd13416a9..22cf086e0e3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Apple.cs @@ -48,6 +48,7 @@ public Apple(Option kind = default) /// Used to track the state of Kind /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option KindOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs index 583e86cb7bf5..9d81d60d111c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Banana.cs @@ -48,6 +48,7 @@ public Banana(Option count = default) /// Used to track the state of Count /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CountOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs index 03ece3cda5af..78554584979a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netcore-latest-oneOf/src/Org.OpenAPITools/Model/Fruit.cs @@ -71,6 +71,7 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs index 2967b0cfe7d2..306058f38c3a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Activity.cs @@ -46,6 +46,7 @@ public Activity(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ActivityOutputsOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Activity activity, JsonSe throw new ArgumentNullException(nameof(activity.ActivityOutputs), "Property is required for class Activity."); if (activity.ActivityOutputsOption.IsSet) + { writer.WritePropertyName("activity_outputs"); JsonSerializer.Serialize(writer, activity.ActivityOutputs, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs index e4819e39a5bb..70b907a2f5c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ActivityOutputElementRepresentation.cs @@ -48,6 +48,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop1 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop1Option { get; private set; } /// @@ -60,6 +61,7 @@ public ActivityOutputElementRepresentation(Option prop1 = default, Optio /// Used to track the state of Prop2 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Prop2Option { get; private set; } /// @@ -196,8 +198,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ActivityOutputElementRepr writer.WriteString("prop1", activityOutputElementRepresentation.Prop1); if (activityOutputElementRepresentation.Prop2Option.IsSet) + { writer.WritePropertyName("prop2"); JsonSerializer.Serialize(writer, activityOutputElementRepresentation.Prop2, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 0fa0ed15c912..dfd7ec688162 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -60,6 +60,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmptyMapOption { get; private set; } /// @@ -73,6 +74,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> MapOfMapPropertyOption { get; private set; } /// @@ -85,6 +87,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapPropertyOption { get; private set; } /// @@ -97,6 +100,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype1Option { get; private set; } /// @@ -109,6 +113,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MapWithUndeclaredPropertiesAnytype2Option { get; private set; } /// @@ -121,6 +126,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapWithUndeclaredPropertiesAnytype3Option { get; private set; } /// @@ -133,6 +139,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapWithUndeclaredPropertiesStringOption { get; private set; } /// @@ -145,6 +152,7 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Anytype1Option { get; private set; } /// @@ -345,26 +353,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); if (additionalPropertiesClass.EmptyMapOption.IsSet) + { writer.WritePropertyName("empty_map"); JsonSerializer.Serialize(writer, additionalPropertiesClass.EmptyMap, jsonSerializerOptions); + } if (additionalPropertiesClass.MapOfMapPropertyOption.IsSet) + { writer.WritePropertyName("map_of_map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapOfMapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapPropertyOption.IsSet) + { writer.WritePropertyName("map_property"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapProperty, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_1"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype1, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_2"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype2, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3Option.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_anytype_3"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesAnytype3, jsonSerializerOptions); + } if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet) + { writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); + } if (additionalPropertiesClass.Anytype1Option.IsSet) if (additionalPropertiesClass.Anytype1Option.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs index 921afe647f07..017eb4dc94bf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Animal.cs @@ -54,6 +54,7 @@ public Animal(string className, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs index 74fa2260d40f..51008671a471 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ApiResponse.cs @@ -50,6 +50,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Code /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CodeOption { get; private set; } /// @@ -62,6 +63,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Message /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MessageOption { get; private set; } /// @@ -74,6 +76,7 @@ public ApiResponse(Option code = default, Option message = default /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs index a6c311a3742c..e193be63a225 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Apple.cs @@ -50,6 +50,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of ColorCode /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorCodeOption { get; private set; } /// @@ -62,6 +63,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of Cultivar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CultivarOption { get; private set; } /// @@ -74,6 +76,7 @@ public Apple(Option colorCode = default, Option cultivar = defau /// Used to track the state of Origin /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OriginOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs index b7818ca9aa56..b4551174f52f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AppleReq.cs @@ -54,6 +54,7 @@ public AppleReq(string cultivar, Option mealy = default) /// Used to track the state of Mealy /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MealyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs index 22f1f89b1fe4..5eed5f320141 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfArrayOfNumberOnly.cs @@ -46,6 +46,7 @@ public ArrayOfArrayOfNumberOnly(Option>> arrayArrayNumber = d /// Used to track the state of ArrayArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayNumberOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfArrayOfNumberOnly throw new ArgumentNullException(nameof(arrayOfArrayOfNumberOnly.ArrayArrayNumber), "Property is required for class ArrayOfArrayOfNumberOnly."); if (arrayOfArrayOfNumberOnly.ArrayArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayArrayNumber"); JsonSerializer.Serialize(writer, arrayOfArrayOfNumberOnly.ArrayArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs index be73ffe15930..5336a5b2dbbf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayOfNumberOnly.cs @@ -46,6 +46,7 @@ public ArrayOfNumberOnly(Option> arrayNumber = default) /// Used to track the state of ArrayNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayNumberOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayOfNumberOnly arrayOf throw new ArgumentNullException(nameof(arrayOfNumberOnly.ArrayNumber), "Property is required for class ArrayOfNumberOnly."); if (arrayOfNumberOnly.ArrayNumberOption.IsSet) + { writer.WritePropertyName("ArrayNumber"); JsonSerializer.Serialize(writer, arrayOfNumberOnly.ArrayNumber, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs index 1d983789c4dc..9ec2bd39bfed 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ArrayTest.cs @@ -50,6 +50,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayOfIntegerOption { get; private set; } /// @@ -62,6 +63,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayArrayOfModel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> ArrayArrayOfModelOption { get; private set; } /// @@ -74,6 +76,7 @@ public ArrayTest(Option>> arrayArrayOfInteger = default, Option< /// Used to track the state of ArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayOfStringOption { get; private set; } /// @@ -220,14 +223,20 @@ public void WriteProperties(ref Utf8JsonWriter writer, ArrayTest arrayTest, Json throw new ArgumentNullException(nameof(arrayTest.ArrayOfString), "Property is required for class ArrayTest."); if (arrayTest.ArrayArrayOfIntegerOption.IsSet) + { writer.WritePropertyName("array_array_of_integer"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfInteger, jsonSerializerOptions); + } if (arrayTest.ArrayArrayOfModelOption.IsSet) + { writer.WritePropertyName("array_array_of_model"); JsonSerializer.Serialize(writer, arrayTest.ArrayArrayOfModel, jsonSerializerOptions); + } if (arrayTest.ArrayOfStringOption.IsSet) + { writer.WritePropertyName("array_of_string"); JsonSerializer.Serialize(writer, arrayTest.ArrayOfString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs index cd4bee166bed..bab9e17b8245 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Banana.cs @@ -46,6 +46,7 @@ public Banana(Option lengthCm = default) /// Used to track the state of LengthCm /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LengthCmOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs index a8ede7f6f250..82a047319d31 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/BananaReq.cs @@ -54,6 +54,7 @@ public BananaReq(decimal lengthCm, Option sweet = default) /// Used to track the state of Sweet /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SweetOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs index 0808395011fa..b038e95b9c01 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Capitalization.cs @@ -56,6 +56,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of ATT_NAME /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ATT_NAMEOption { get; private set; } /// @@ -69,6 +70,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of CapitalCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalCamelOption { get; private set; } /// @@ -81,6 +83,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of CapitalSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CapitalSnakeOption { get; private set; } /// @@ -93,6 +96,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SCAETHFlowPoints /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SCAETHFlowPointsOption { get; private set; } /// @@ -105,6 +109,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SmallCamel /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallCamelOption { get; private set; } /// @@ -117,6 +122,7 @@ public Capitalization(Option aTTNAME = default, Option capitalCa /// Used to track the state of SmallSnake /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SmallSnakeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index 527b12a3d4a2..ebb60c07c02c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -48,6 +48,7 @@ public Cat(string className, Option declawed = default, Option co /// Used to track the state of Declawed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeclawedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index c0488a98bdd5..9e7d1939c1e8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -54,6 +54,7 @@ public Category(string name = @"default-name", Option id = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs index 531c5d0798b7..52579d169718 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ChildCat.cs @@ -100,6 +100,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of PetType /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public new Option PetTypeOption { get; private set; } /// @@ -112,6 +113,7 @@ public static string PetTypeEnumToJsonValue(PetTypeEnum? value) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs index 26b73fda643f..b7ef5105c6a1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ClassModel.cs @@ -46,6 +46,7 @@ public ClassModel(Option varClass = default) /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs index 6bd2ac02a9af..9bfd36317daf 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DateOnlyClass.cs @@ -46,6 +46,7 @@ public DateOnlyClass(Option dateOnlyProperty = default) /// Used to track the state of DateOnlyProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateOnlyPropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs index 3e35b28521a2..1ef8301d0c3d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/DeprecatedObject.cs @@ -46,6 +46,7 @@ public DeprecatedObject(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs index 977d6867dae3..933668a94262 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Dog.cs @@ -48,6 +48,7 @@ public Dog(string className, Option breed = default, Option colo /// Used to track the state of Breed /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BreedOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 527c50af78e0..509e00060834 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -52,6 +52,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of MainShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MainShapeOption { get; private set; } /// @@ -64,6 +65,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of Shapes /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ShapesOption { get; private set; } /// @@ -76,6 +78,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of NullableShape /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableShapeOption { get; private set; } /// @@ -88,6 +91,7 @@ public Drawing(Option mainShape = default, Option> shapes = d /// Used to track the state of ShapeOrNull /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShapeOrNullOption { get; private set; } /// @@ -245,11 +249,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri throw new ArgumentNullException(nameof(drawing.Shapes), "Property is required for class Drawing."); if (drawing.MainShapeOption.IsSet) + { writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); + } if (drawing.ShapesOption.IsSet) + { writer.WritePropertyName("shapes"); JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs index 8517a7937c4c..4780ffd6faf5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -180,6 +180,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of JustSymbol /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustSymbolOption { get; private set; } /// @@ -192,6 +193,7 @@ public static string JustSymbolEnumToJsonValue(JustSymbolEnum? value) /// Used to track the state of ArrayEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayEnumOption { get; private set; } /// @@ -324,8 +326,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumArrays enumArrays, Js throw new ArgumentNullException(nameof(enumArrays.ArrayEnum), "Property is required for class EnumArrays."); if (enumArrays.ArrayEnumOption.IsSet) + { writer.WritePropertyName("array_enum"); JsonSerializer.Serialize(writer, enumArrays.ArrayEnum, jsonSerializerOptions); + } var justSymbolRawValue = EnumArrays.JustSymbolEnumToJsonValue(enumArrays.JustSymbolOption.Value.Value); if (justSymbolRawValue != null) writer.WriteString("just_symbol", justSymbolRawValue); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index cbc244d9a164..3681bdf3e545 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -277,6 +277,7 @@ public static int EnumIntegerEnumToJsonValue(EnumIntegerEnum value) /// Used to track the state of EnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOption { get; private set; } /// @@ -348,6 +349,7 @@ public static int EnumIntegerOnlyEnumToJsonValue(EnumIntegerOnlyEnum value) /// Used to track the state of EnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumIntegerOnlyOption { get; private set; } /// @@ -426,6 +428,7 @@ public static double EnumNumberEnumToJsonValue(EnumNumberEnum? value) /// Used to track the state of EnumNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumNumberOption { get; private set; } /// @@ -588,6 +591,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of EnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EnumStringOption { get; private set; } /// @@ -600,6 +604,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumDefaultValueOption { get; private set; } /// @@ -612,6 +617,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerOption { get; private set; } /// @@ -624,6 +630,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnumIntegerDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumIntegerDefaultValueOption { get; private set; } /// @@ -636,6 +643,7 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) /// Used to track the state of OuterEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option OuterEnumOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs index 8b49ccc48188..213451addd45 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/File.cs @@ -46,6 +46,7 @@ public File(Option sourceURI = default) /// Used to track the state of SourceURI /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SourceURIOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs index 9afb1e2575bd..525183c27c96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -48,6 +48,7 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of File /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FileOption { get; private set; } /// @@ -60,6 +61,7 @@ public FileSchemaTestClass(Option file = default, Option> files /// Used to track the state of Files /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> FilesOption { get; private set; } /// @@ -194,11 +196,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, FileSchemaTestClass fileS throw new ArgumentNullException(nameof(fileSchemaTestClass.Files), "Property is required for class FileSchemaTestClass."); if (fileSchemaTestClass.FileOption.IsSet) + { writer.WritePropertyName("file"); JsonSerializer.Serialize(writer, fileSchemaTestClass.File, jsonSerializerOptions); + } if (fileSchemaTestClass.FilesOption.IsSet) + { writer.WritePropertyName("files"); JsonSerializer.Serialize(writer, fileSchemaTestClass.Files, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs index 5643834b58d6..f4b99d158e8b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Foo.cs @@ -46,6 +46,7 @@ public Foo(Option bar = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs index 07c6b69c2b19..7e6890ba3bf8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FooGetDefaultResponse.cs @@ -46,6 +46,7 @@ public FooGetDefaultResponse(Option varString = default) /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, FooGetDefaultResponse foo throw new ArgumentNullException(nameof(fooGetDefaultResponse.VarString), "Property is required for class FooGetDefaultResponse."); if (fooGetDefaultResponse.VarStringOption.IsSet) + { writer.WritePropertyName("string"); JsonSerializer.Serialize(writer, fooGetDefaultResponse.VarString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs index dfe8433034cd..29eff0cd769f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/FormatTest.cs @@ -107,6 +107,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Binary /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BinaryOption { get; private set; } /// @@ -119,6 +120,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -132,6 +134,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDecimal /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDecimalOption { get; private set; } /// @@ -144,6 +147,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarDouble /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarDoubleOption { get; private set; } /// @@ -156,6 +160,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarFloat /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarFloatOption { get; private set; } /// @@ -168,6 +173,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int32 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int32Option { get; private set; } /// @@ -180,6 +186,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Int64 /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Int64Option { get; private set; } /// @@ -192,6 +199,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Integer /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerOption { get; private set; } /// @@ -204,6 +212,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithBackslash /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithBackslashOption { get; private set; } /// @@ -217,6 +226,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigits /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsOption { get; private set; } /// @@ -230,6 +240,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of PatternWithDigitsAndDelimiter /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PatternWithDigitsAndDelimiterOption { get; private set; } /// @@ -243,6 +254,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of VarString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarStringOption { get; private set; } /// @@ -255,6 +267,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedIntegerOption { get; private set; } /// @@ -267,6 +280,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of UnsignedLong /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnsignedLongOption { get; private set; } /// @@ -279,6 +293,7 @@ public FormatTest(byte[] varByte, DateTime date, decimal number, string password /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -731,14 +746,18 @@ public void WriteProperties(ref Utf8JsonWriter writer, FormatTest formatTest, Js writer.WriteString("password", formatTest.Password); if (formatTest.BinaryOption.IsSet) + { writer.WritePropertyName("binary"); JsonSerializer.Serialize(writer, formatTest.Binary, jsonSerializerOptions); + } if (formatTest.DateTimeOption.IsSet) writer.WriteString("dateTime", formatTest.DateTimeOption.Value.Value.ToString(DateTimeFormat)); if (formatTest.VarDecimalOption.IsSet) + { writer.WritePropertyName("decimal"); JsonSerializer.Serialize(writer, formatTest.VarDecimal, jsonSerializerOptions); + } if (formatTest.VarDoubleOption.IsSet) writer.WriteNumber("double", formatTest.VarDoubleOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs index a9939e84aa0c..efc98a08e71c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Fruit.cs @@ -69,6 +69,7 @@ public Fruit(Banana banana, Option color = default) /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs index 6043820f85ea..b9f6c12dea7a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/GmFruit.cs @@ -49,6 +49,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Apple /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AppleOption { get; private set; } /// @@ -60,6 +61,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Banana /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BananaOption { get; private set; } /// @@ -71,6 +73,7 @@ public GmFruit(Option apple, Option banana, Option color /// Used to track the state of Color /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ColorOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs index ea29e35293ae..9652b767d130 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HasOnlyReadOnly.cs @@ -48,6 +48,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -60,6 +61,7 @@ internal HasOnlyReadOnly(Option bar = default, Option foo = defa /// Used to track the state of Foo /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FooOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs index 2bd4dc077f11..568712d2708a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/HealthCheckResult.cs @@ -46,6 +46,7 @@ public HealthCheckResult(Option nullableMessage = default) /// Used to track the state of NullableMessage /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NullableMessageOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs index ff2cc44b489b..f21994c35234 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/List.cs @@ -46,6 +46,7 @@ public List(Option var123List = default) /// Used to track the state of Var123List /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123ListOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs index 00114f12354c..cfc824d8f5a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/LiteralStringClass.cs @@ -48,6 +48,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of EscapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EscapedLiteralStringOption { get; private set; } /// @@ -60,6 +61,7 @@ public LiteralStringClass(Option escapedLiteralString = default, Option< /// Used to track the state of UnescapedLiteralString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UnescapedLiteralStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs index bcb3ca50b727..b620db4b59dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MapTest.cs @@ -118,6 +118,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of DirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> DirectMapOption { get; private set; } /// @@ -130,6 +131,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of IndirectMap /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> IndirectMapOption { get; private set; } /// @@ -142,6 +144,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of MapMapOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option>> MapMapOfStringOption { get; private set; } /// @@ -154,6 +157,7 @@ public static string InnerEnumToJsonValue(InnerEnum value) /// Used to track the state of MapOfEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapOfEnumStringOption { get; private set; } /// @@ -312,17 +316,25 @@ public void WriteProperties(ref Utf8JsonWriter writer, MapTest mapTest, JsonSeri throw new ArgumentNullException(nameof(mapTest.MapOfEnumString), "Property is required for class MapTest."); if (mapTest.DirectMapOption.IsSet) + { writer.WritePropertyName("direct_map"); JsonSerializer.Serialize(writer, mapTest.DirectMap, jsonSerializerOptions); + } if (mapTest.IndirectMapOption.IsSet) + { writer.WritePropertyName("indirect_map"); JsonSerializer.Serialize(writer, mapTest.IndirectMap, jsonSerializerOptions); + } if (mapTest.MapMapOfStringOption.IsSet) + { writer.WritePropertyName("map_map_of_string"); JsonSerializer.Serialize(writer, mapTest.MapMapOfString, jsonSerializerOptions); + } if (mapTest.MapOfEnumStringOption.IsSet) + { writer.WritePropertyName("map_of_enum_string"); JsonSerializer.Serialize(writer, mapTest.MapOfEnumString, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs index c2f1278cd29e..b75b184b9ad2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/MixedPropertiesAndAdditionalPropertiesClass.cs @@ -52,6 +52,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of DateTime /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DateTimeOption { get; private set; } /// @@ -64,6 +65,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Map /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> MapOption { get; private set; } /// @@ -76,6 +78,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -88,6 +91,7 @@ public MixedPropertiesAndAdditionalPropertiesClass(Option dateTime = /// Used to track the state of UuidWithPattern /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidWithPatternOption { get; private set; } /// @@ -252,8 +256,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, MixedPropertiesAndAdditio writer.WriteString("dateTime", mixedPropertiesAndAdditionalPropertiesClass.DateTimeOption.Value.Value.ToString(DateTimeFormat)); if (mixedPropertiesAndAdditionalPropertiesClass.MapOption.IsSet) + { writer.WritePropertyName("map"); JsonSerializer.Serialize(writer, mixedPropertiesAndAdditionalPropertiesClass.Map, jsonSerializerOptions); + } if (mixedPropertiesAndAdditionalPropertiesClass.UuidOption.IsSet) writer.WriteString("uuid", mixedPropertiesAndAdditionalPropertiesClass.UuidOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs index 4146f3d0ea53..ba4afe20a018 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Model200Response.cs @@ -48,6 +48,7 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of VarClass /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClassOption { get; private set; } /// @@ -60,6 +61,7 @@ public Model200Response(Option varClass = default, Option name = d /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs index 78e157c3579c..2830a1d51350 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ModelClient.cs @@ -46,6 +46,7 @@ public ModelClient(Option varClient = default) /// Used to track the state of VarClient /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarClientOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs index 0707bcfac9ae..7403eda73f2c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Name.cs @@ -58,6 +58,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of Property /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PropertyOption { get; private set; } /// @@ -70,6 +71,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of SnakeCase /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SnakeCaseOption { get; } /// @@ -82,6 +84,7 @@ public Name(int varName, Option property = default, Option snakeCa /// Used to track the state of Var123Number /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option Var123NumberOption { get; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index 361ef1167072..db07e377b094 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -68,6 +68,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayItemsNullableOption { get; private set; } /// @@ -80,6 +81,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectItemsNullableOption { get; private set; } /// @@ -92,6 +94,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayAndItemsNullablePropOption { get; private set; } /// @@ -104,6 +107,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ArrayNullablePropOption { get; private set; } /// @@ -116,6 +120,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BooleanPropOption { get; private set; } /// @@ -128,6 +133,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatePropOption { get; private set; } /// @@ -140,6 +146,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DatetimePropOption { get; private set; } /// @@ -152,6 +159,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IntegerPropOption { get; private set; } /// @@ -164,6 +172,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NumberPropOption { get; private set; } /// @@ -176,6 +185,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectAndItemsNullablePropOption { get; private set; } /// @@ -188,6 +198,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> ObjectNullablePropOption { get; private set; } /// @@ -200,6 +211,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StringPropOption { get; private set; } /// @@ -414,11 +426,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); if (nullableClass.ArrayItemsNullableOption.IsSet) + { writer.WritePropertyName("array_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectItemsNullableOption.IsSet) + { writer.WritePropertyName("object_items_nullable"); JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs index a46e93b03b7d..415b5b58a977 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableGuidClass.cs @@ -46,6 +46,7 @@ public NullableGuidClass(Option uuid = default) /// Used to track the state of Uuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs index d816d1cf8a01..dff14aaba024 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NumberOnly.cs @@ -46,6 +46,7 @@ public NumberOnly(Option justNumber = default) /// Used to track the state of JustNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option JustNumberOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs index 1190c9cd6457..a11aee11212b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ObjectWithDeprecatedFields.cs @@ -52,6 +52,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> BarsOption { get; private set; } /// @@ -65,6 +66,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option DeprecatedRefOption { get; private set; } /// @@ -78,6 +80,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -91,6 +94,7 @@ public ObjectWithDeprecatedFields(Option> bars = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UuidOption { get; private set; } /// @@ -245,11 +249,15 @@ public void WriteProperties(ref Utf8JsonWriter writer, ObjectWithDeprecatedField throw new ArgumentNullException(nameof(objectWithDeprecatedFields.Uuid), "Property is required for class ObjectWithDeprecatedFields."); if (objectWithDeprecatedFields.BarsOption.IsSet) + { writer.WritePropertyName("bars"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.Bars, jsonSerializerOptions); + } if (objectWithDeprecatedFields.DeprecatedRefOption.IsSet) + { writer.WritePropertyName("deprecatedRef"); JsonSerializer.Serialize(writer, objectWithDeprecatedFields.DeprecatedRef, jsonSerializerOptions); + } if (objectWithDeprecatedFields.IdOption.IsSet) writer.WriteNumber("id", objectWithDeprecatedFields.IdOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index 1a9114eac536..437b51c29fd5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -137,6 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -150,6 +151,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -162,6 +164,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of PetId /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PetIdOption { get; private set; } /// @@ -174,6 +177,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Quantity /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option QuantityOption { get; private set; } /// @@ -186,6 +190,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of ShipDate /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ShipDateOption { get; private set; } /// @@ -199,6 +204,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Complete /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CompleteOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs index 6f38c4ff6fdc..42665b8a066c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/OuterComposite.cs @@ -50,6 +50,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyBoolean /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyBooleanOption { get; private set; } /// @@ -62,6 +63,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyNumber /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyNumberOption { get; private set; } /// @@ -74,6 +76,7 @@ public OuterComposite(Option myBoolean = default, Option myNumb /// Used to track the state of MyString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option MyStringOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs index 57e4765357ec..992e25a8486c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Pet.cs @@ -137,6 +137,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Status /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option StatusOption { get; private set; } /// @@ -163,6 +164,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Category /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option CategoryOption { get; private set; } /// @@ -175,6 +177,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -187,6 +190,7 @@ public static string StatusEnumToJsonValue(StatusEnum? value) /// Used to track the state of Tags /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> TagsOption { get; private set; } /// @@ -373,8 +377,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WritePropertyName("photoUrls"); JsonSerializer.Serialize(writer, pet.PhotoUrls, jsonSerializerOptions); if (pet.CategoryOption.IsSet) + { writer.WritePropertyName("category"); JsonSerializer.Serialize(writer, pet.Category, jsonSerializerOptions); + } if (pet.IdOption.IsSet) writer.WriteNumber("id", pet.IdOption.Value.Value); @@ -385,8 +391,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Pet pet, JsonSerializerOp writer.WriteNull("status"); if (pet.TagsOption.IsSet) + { writer.WritePropertyName("tags"); JsonSerializer.Serialize(writer, pet.Tags, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs index baba059e050d..d5b7e21838df 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ReadOnlyFirst.cs @@ -48,6 +48,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Bar /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BarOption { get; } /// @@ -60,6 +61,7 @@ public ReadOnlyFirst(Option bar = default, Option baz = default) /// Used to track the state of Baz /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option BazOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs index b639708f815e..3f8a9f593e41 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -483,6 +483,7 @@ public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNo /// Used to track the state of NotrequiredNotnullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// @@ -554,6 +555,7 @@ public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(Notrequir /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// @@ -716,6 +718,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// @@ -728,6 +731,7 @@ public static string NotrequiredNotnullableEnumStringEnumToJsonValue(Notrequired /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1094,6 +1098,7 @@ public static int NotrequiredNullableEnumIntegerEnumToJsonValue(NotrequiredNulla /// Used to track the state of NotrequiredNullableEnumInteger /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOption { get; private set; } /// @@ -1165,6 +1170,7 @@ public static int NotrequiredNullableEnumIntegerOnlyEnumToJsonValue(NotrequiredN /// Used to track the state of NotrequiredNullableEnumIntegerOnly /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumIntegerOnlyOption { get; private set; } /// @@ -1330,6 +1336,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableEnumString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableEnumStringOption { get; private set; } /// @@ -1342,6 +1349,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableOuterEnumDefaultValue /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableOuterEnumDefaultValueOption { get; private set; } /// @@ -1397,6 +1405,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableDatePropOption { get; private set; } /// @@ -1409,6 +1418,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// @@ -1421,6 +1431,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// @@ -1433,6 +1444,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// @@ -1445,6 +1457,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// @@ -1457,6 +1470,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableStringPropOption { get; private set; } /// @@ -1469,6 +1483,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNotnullableUuidOption { get; private set; } /// @@ -1525,6 +1540,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableDatePropOption { get; private set; } /// @@ -1537,6 +1553,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotRequiredNullableIntegerPropOption { get; private set; } /// @@ -1549,6 +1566,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableArrayOfString /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> NotrequiredNullableArrayOfStringOption { get; private set; } /// @@ -1561,6 +1579,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableBooleanProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableBooleanPropOption { get; private set; } /// @@ -1573,6 +1592,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableDatetimeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableDatetimePropOption { get; private set; } /// @@ -1585,6 +1605,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableStringProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableStringPropOption { get; private set; } /// @@ -1597,6 +1618,7 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul /// Used to track the state of NotrequiredNullableUuid /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NotrequiredNullableUuidOption { get; private set; } /// @@ -2193,8 +2215,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { writer.WritePropertyName("notrequired_notnullable_array_of_string"); JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs index 4ee1dfd83a2f..7ef17db222ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Return.cs @@ -46,6 +46,7 @@ public Return(Option varReturn = default) /// Used to track the state of VarReturn /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarReturnOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs index 6063f8c719d4..f7435144367e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHash.cs @@ -48,6 +48,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleOption { get; private set; } /// @@ -60,6 +61,7 @@ public RolesReportsHash(Option role = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option RoleUuidOption { get; private set; } /// @@ -191,8 +193,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, RolesReportsHash rolesRep throw new ArgumentNullException(nameof(rolesReportsHash.Role), "Property is required for class RolesReportsHash."); if (rolesReportsHash.RoleOption.IsSet) + { writer.WritePropertyName("role"); JsonSerializer.Serialize(writer, rolesReportsHash.Role, jsonSerializerOptions); + } if (rolesReportsHash.RoleUuidOption.IsSet) writer.WriteString("role_uuid", rolesReportsHash.RoleUuidOption.Value.Value); } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs index c82e15cbc9de..4a29f6ec7b16 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RolesReportsHashRole.cs @@ -46,6 +46,7 @@ public RolesReportsHashRole(Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs index 9da2291ad11a..81bfc146662c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/SpecialModelName.cs @@ -48,6 +48,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option VarSpecialModelNameOption { get; private set; } /// @@ -60,6 +61,7 @@ public SpecialModelName(Option varSpecialModelName = default, Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SpecialPropertyNameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs index c156d31a3ef9..4f4891d049f1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Tag.cs @@ -48,6 +48,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -60,6 +61,7 @@ public Tag(Option id = default, Option name = default) /// Used to track the state of Name /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option NameOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs index ceaea2e1aa4e..47a94630b7d8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordList.cs @@ -46,6 +46,7 @@ public TestCollectionEndingWithWordList(Option value = default) /// Used to track the state of Value /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ValueOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs index 5594a28119d7..d1b0714cb3c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestCollectionEndingWithWordListObject.cs @@ -46,6 +46,7 @@ public TestCollectionEndingWithWordListObject(Option [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option> TestCollectionEndingWithWordListOption { get; private set; } /// @@ -168,8 +169,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, TestCollectionEndingWithW throw new ArgumentNullException(nameof(testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList), "Property is required for class TestCollectionEndingWithWordListObject."); if (testCollectionEndingWithWordListObject.TestCollectionEndingWithWordListOption.IsSet) + { writer.WritePropertyName("TestCollectionEndingWithWordList"); JsonSerializer.Serialize(writer, testCollectionEndingWithWordListObject.TestCollectionEndingWithWordList, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs index 1a5e4f090270..cac22db5606b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/TestInlineFreeformAdditionalPropertiesRequest.cs @@ -46,6 +46,7 @@ public TestInlineFreeformAdditionalPropertiesRequest(Option someProperty /// Used to track the state of SomeProperty /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option SomePropertyOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index 6b599fe81727..8ee32ec10c7f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -68,6 +68,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Email /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option EmailOption { get; private set; } /// @@ -80,6 +81,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of FirstName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option FirstNameOption { get; private set; } /// @@ -92,6 +94,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Id /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option IdOption { get; private set; } /// @@ -104,6 +107,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of LastName /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option LastNameOption { get; private set; } /// @@ -116,6 +120,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of ObjectWithNoDeclaredProps /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsOption { get; private set; } /// @@ -129,6 +134,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Password /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PasswordOption { get; private set; } /// @@ -141,6 +147,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Phone /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option PhoneOption { get; private set; } /// @@ -153,6 +160,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of UserStatus /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UserStatusOption { get; private set; } /// @@ -166,6 +174,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of Username /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option UsernameOption { get; private set; } /// @@ -178,6 +187,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of AnyTypeProp /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropOption { get; private set; } /// @@ -191,6 +201,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of AnyTypePropNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option AnyTypePropNullableOption { get; private set; } /// @@ -204,6 +215,7 @@ public User(Option email = default, Option firstName = default, /// Used to track the state of ObjectWithNoDeclaredPropsNullable /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } /// @@ -441,8 +453,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WriteString("lastName", user.LastName); if (user.ObjectWithNoDeclaredPropsOption.IsSet) + { writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); + } if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs index 55d2f2b0c6d9..de887038530b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Whale.cs @@ -56,6 +56,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasBaleen /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasBaleenOption { get; private set; } /// @@ -68,6 +69,7 @@ public Whale(string className, Option hasBaleen = default, Option /// Used to track the state of HasTeeth /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option HasTeethOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs index bf474ddc5515..895e2f5553ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Zebra.cs @@ -128,6 +128,7 @@ public static string TypeEnumToJsonValue(TypeEnum? value) /// Used to track the state of Type /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option TypeOption { get; private set; } /// diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs index 6134606bedb1..c052c6497696 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/ZeroBasedEnumClass.cs @@ -112,6 +112,7 @@ public static string ZeroBasedEnumEnumToJsonValue(ZeroBasedEnumEnum? value) /// Used to track the state of ZeroBasedEnum /// [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] public Option ZeroBasedEnumOption { get; private set; } /// From baed4ef89fd67c62b23df8992210470ba17e2e00 Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 17:03:12 -0500 Subject: [PATCH 22/23] updated documentation --- .../openapitools/codegen/templating/mustache/CopyLambda.java | 4 ++-- .../openapitools/codegen/templating/mustache/PasteLambda.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java index f3e5fe8138a5..f1e4868c59b7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/CopyLambda.java @@ -27,12 +27,12 @@ * * Register: *
- * additionalProperties.put("save", new SaveLambda());
+ * additionalProperties.put("copy", new CopyLambda());
  * 
* * Use: *
- * {{#save}}{{name}}{{/save}}
+ * {{#copy}}{{name}}{{/copy}}
  * 
*/ public class CopyLambda implements Mustache.Lambda { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java index 8a78457176d3..ea798d9dc3c3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/templating/mustache/PasteLambda.java @@ -27,12 +27,12 @@ * * Register: *
- * additionalProperties.put("write", new WriteLambda());
+ * additionalProperties.put("paste", new PasteLambda(copyLambda, true, true, true, false));
  * 
* * Use: *
- * {{#write}}{{name}}{{/write}}
+ * {{#paste}}{{/paste}}
  * 
*/ public class PasteLambda implements Mustache.Lambda { From 0116d4ae9532297089afffe17a44df69c45bd25f Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 5 Nov 2023 17:34:07 -0500 Subject: [PATCH 23/23] improved parameter ordering --- .../languages/CSharpClientCodegen.java | 45 +- .../UnitTest1.cs | 4 +- .../UnitTest1.cs | 2 +- .../docs/models/AdditionalPropertiesClass.md | 2 +- .../docs/models/Category.md | 2 +- .../docs/models/Drawing.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/NullableClass.md | 4 +- .../docs/models/Order.md | 2 +- .../docs/models/RequiredClass.md | 22 +- .../docs/models/User.md | 6 +- .../UseSourceGeneration/Client/ClientUtils.cs | 12 +- .../Model/AdditionalPropertiesClass.cs | 62 +- .../src/UseSourceGeneration/Model/Cat.cs | 26 +- .../src/UseSourceGeneration/Model/Category.cs | 40 +- .../src/UseSourceGeneration/Model/Drawing.cs | 56 +- .../src/UseSourceGeneration/Model/EnumTest.cs | 64 +- .../Model/NullableClass.cs | 102 +-- .../src/UseSourceGeneration/Model/Order.cs | 58 +- .../Model/RequiredClass.cs | 788 +++++++++--------- .../src/UseSourceGeneration/Model/User.cs | 185 ++-- .../docs/models/AdditionalPropertiesClass.md | 2 +- .../docs/models/Category.md | 2 +- .../docs/models/Drawing.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/NullableClass.md | 4 +- .../docs/models/Order.md | 2 +- .../docs/models/RequiredClass.md | 22 +- .../docs/models/User.md | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 12 +- .../Model/AdditionalPropertiesClass.cs | 62 +- .../src/Org.OpenAPITools/Model/Cat.cs | 26 +- .../src/Org.OpenAPITools/Model/Category.cs | 40 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 56 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 +- .../Org.OpenAPITools/Model/NullableClass.cs | 102 +-- .../src/Org.OpenAPITools/Model/Order.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 788 +++++++++--------- .../src/Org.OpenAPITools/Model/User.cs | 185 ++-- .../docs/models/AdditionalPropertiesClass.md | 2 +- .../docs/models/Category.md | 2 +- .../docs/models/Drawing.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/NullableClass.md | 4 +- .../docs/models/Order.md | 2 +- .../docs/models/RequiredClass.md | 22 +- .../docs/models/User.md | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 12 +- .../Model/AdditionalPropertiesClass.cs | 62 +- .../src/Org.OpenAPITools/Model/Cat.cs | 26 +- .../src/Org.OpenAPITools/Model/Category.cs | 40 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 56 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 +- .../Org.OpenAPITools/Model/NullableClass.cs | 102 +-- .../src/Org.OpenAPITools/Model/Order.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 788 +++++++++--------- .../src/Org.OpenAPITools/Model/User.cs | 185 ++-- .../docs/models/AdditionalPropertiesClass.md | 2 +- .../docs/models/Category.md | 2 +- .../docs/models/Drawing.md | 2 +- .../docs/models/EnumTest.md | 2 +- .../docs/models/NullableClass.md | 4 +- .../docs/models/Order.md | 2 +- .../docs/models/RequiredClass.md | 22 +- .../docs/models/User.md | 6 +- .../Org.OpenAPITools/Client/ClientUtils.cs | 12 +- .../Model/AdditionalPropertiesClass.cs | 62 +- .../src/Org.OpenAPITools/Model/Cat.cs | 26 +- .../src/Org.OpenAPITools/Model/Category.cs | 40 +- .../src/Org.OpenAPITools/Model/Drawing.cs | 56 +- .../src/Org.OpenAPITools/Model/EnumTest.cs | 64 +- .../Org.OpenAPITools/Model/NullableClass.cs | 102 +-- .../src/Org.OpenAPITools/Model/Order.cs | 58 +- .../Org.OpenAPITools/Model/RequiredClass.cs | 788 +++++++++--------- .../src/Org.OpenAPITools/Model/User.cs | 185 ++-- 75 files changed, 2881 insertions(+), 2910 deletions(-) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index a5a6d7f44ae3..fa33ee56c645 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -454,14 +454,13 @@ public CodegenModel fromModel(String name, Schema model) { Collections.sort(codegenModel.readWriteVars, propertyComparatorByName); Collections.sort(codegenModel.parentVars, propertyComparatorByName); - Comparator comparator = propertyComparatorByNullable.thenComparing(propertyComparatorByRequired).thenComparing(propertyComparatorByDefaultValue); - Collections.sort(codegenModel.vars, comparator); - Collections.sort(codegenModel.allVars, comparator); - Collections.sort(codegenModel.requiredVars, comparator); - Collections.sort(codegenModel.optionalVars, comparator); - Collections.sort(codegenModel.readOnlyVars, comparator); - Collections.sort(codegenModel.readWriteVars, comparator); - Collections.sort(codegenModel.parentVars, comparator); + Collections.sort(codegenModel.vars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.allVars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.requiredVars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.optionalVars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.readOnlyVars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.readWriteVars, propertyComparatorByNotNullableRequiredNoDefault); + Collections.sort(codegenModel.parentVars, propertyComparatorByNotNullableRequiredNoDefault); } return codegenModel; @@ -474,36 +473,12 @@ public int compare(CodegenProperty one, CodegenProperty another) { } }; - public static Comparator propertyComparatorByDefaultValue = new Comparator() { + public static Comparator propertyComparatorByNotNullableRequiredNoDefault = new Comparator() { @Override public int compare(CodegenProperty one, CodegenProperty another) { - if ((one.defaultValue == null) == (another.defaultValue == null)) - return 0; - else if (one.defaultValue == null) - return -1; - else - return 1; - } - }; - - public static Comparator propertyComparatorByRequired = new Comparator() { - @Override - public int compare(CodegenProperty one, CodegenProperty another) { - if (one.required == another.required) - return 0; - else if (Boolean.TRUE.equals(one.required)) - return -1; - else - return 1; - } - }; - - public static Comparator propertyComparatorByNullable = new Comparator() { - @Override - public int compare(CodegenProperty one, CodegenProperty another) { - if (one.isNullable == another.isNullable) + if (one.isNullable == another.isNullable && one.required == another.required && (one.defaultValue == null) == (another.defaultValue == null)) return 0; - else if (Boolean.FALSE.equals(one.isNullable)) + else if (!one.isNullable && one.required && one.defaultValue == null) return -1; else return 1; diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs index 0a0c680ac271..24989ea90db7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/ManualTests.Latest.UseSourceGeneration/UnitTest1.cs @@ -51,7 +51,7 @@ public SerializationTests() [TestMethod] public void Category() { - Category category = new("test", 1); + Category category = new(1, "test"); string categoryJson = JsonSerializer.Serialize(category, _jsonSerializerOptions); Category? category2 = JsonSerializer.Deserialize(categoryJson, _jsonSerializerOptions); Assert.AreEqual(category.Id, category2?.Id); @@ -152,7 +152,7 @@ public void ChildCatTest() [TestMethod] public void Cat() { - Cat cat = new("cat", false, "black"); // TODO: where is the address property? + Cat cat = new("cat", "black", false); // TODO: where is the address property? string catJson = JsonSerializer.Serialize(cat, _jsonSerializerOptions); Cat? cat2 = JsonSerializer.Deserialize(catJson, _jsonSerializerOptions); Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color != null && cat.Color.Equals(cat2.Color)); // TODO: add the address property diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs index e59c6682f74f..60f9abd940ba 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-manual-tests/OpenAPIClient-generichost-manual-tests/UnitTest1.cs @@ -138,7 +138,7 @@ public void ChildCat() [TestMethod] public void Cat() { - Cat cat = new("cat", false, "black"); // TODO: where is the address property? + Cat cat = new("cat", "black", false); // TODO: where is the address property? string catJson = JsonSerializer.Serialize(cat, _jsonSerializerOptions); Cat? cat2 = JsonSerializer.Deserialize(catJson, _jsonSerializerOptions); Assert.IsTrue(cat2 != null && cat.Declawed.Equals(cat2.Declawed) && cat.ClassName.Equals(cat2.ClassName) && cat.Color != null && cat.Color.Equals(cat2.Color)); // TODO: add the address property diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/AdditionalPropertiesClass.md index 0cd0716de5f8..60851b8b7ba8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/AdditionalPropertiesClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/AdditionalPropertiesClass.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] **EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] **MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapProperty** | **Dictionary<string, string>** | | [optional] @@ -11,7 +12,6 @@ Name | Type | Description | Notes **MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] **MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] **MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] -**Anytype1** | **Object** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md index 5127709c28f2..cebefe7ff377 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Drawing.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Drawing.md index a9a319fd6bba..00ab29d641dc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Drawing.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Drawing.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MainShape** | [**Shape**](Shape.md) | | [optional] -**Shapes** | [**List<Shape>**](Shape.md) | | [optional] **NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] **ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md index f598aab71491..b1e5ad4bc428 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/EnumTest.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] -**OuterEnum** | **OuterEnum** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/NullableClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/NullableClass.md index 3bc480afe036..ce95a131e6c1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/NullableClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/NullableClass.md @@ -4,9 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ArrayItemsNullable** | **List<Object>** | | [optional] -**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] **ArrayNullableProp** | **List<Object>** | | [optional] **BooleanProp** | **bool** | | [optional] **DateProp** | **DateTime** | | [optional] @@ -14,6 +13,7 @@ Name | Type | Description | Notes **IntegerProp** | **int** | | [optional] **NumberProp** | **decimal** | | [optional] **ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] **StringProp** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Order.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Order.md index 3ec4ab0e9adf..e1399706ef96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Order.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/Order.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] **Id** | **long** | | [optional] **PetId** | **long** | | [optional] **Quantity** | **int** | | [optional] **ShipDate** | **DateTime** | | [optional] **Status** | **string** | Order Status | [optional] -**Complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md index 0051888c2aed..fa83b86d5719 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/RequiredClass.md @@ -15,17 +15,6 @@ Name | Type | Description | Notes **RequiredNotnullableStringProp** | **string** | | **RequiredNotnullableUuid** | **Guid** | | **RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] **RequiredNullableArrayOfString** | **List<string>** | | **RequiredNullableBooleanProp** | **bool** | | **RequiredNullableDateProp** | **DateTime** | | @@ -37,8 +26,19 @@ Name | Type | Description | Notes **RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | **RequiredNullableStringProp** | **string** | | **RequiredNullableUuid** | **Guid** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] **NotRequiredNullableDateProp** | **DateTime** | | [optional] **NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] **NotrequiredNullableArrayOfString** | **List<string>** | | [optional] **NotrequiredNullableBooleanProp** | **bool** | | [optional] **NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/User.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/User.md index 9c3095927a69..4b5d0d81b718 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/User.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/docs/models/User.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] **Email** | **string** | | [optional] **FirstName** | **string** | | [optional] **Id** | **long** | | [optional] **LastName** | **string** | | [optional] **ObjectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] **Password** | **string** | | [optional] **Phone** | **string** | | [optional] **UserStatus** | **int** | User Status | [optional] **Username** | **string** | | [optional] -**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] -**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] -**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs index f4eb80997ea9..3b9dc7cfc156 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Client/ClientUtils.cs @@ -175,18 +175,18 @@ public static string SanitizeFilename(string filename) return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs index 5cc440012987..b0310944a823 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/AdditionalPropertiesClass.cs @@ -35,6 +35,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// /// Initializes a new instance of the class. /// + /// anytype1 /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// mapOfMapProperty /// mapProperty @@ -42,10 +43,10 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesAnytype2 /// mapWithUndeclaredPropertiesAnytype3 /// mapWithUndeclaredPropertiesString - /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default) { + Anytype1Option = anytype1; EmptyMapOption = emptyMap; MapOfMapPropertyOption = mapOfMapProperty; MapPropertyOption = mapProperty; @@ -53,12 +54,24 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option + /// Used to track the state of Anytype1 + ///
+ [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } + /// /// Used to track the state of EmptyMap /// @@ -151,19 +164,6 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } - /// - /// Used to track the state of Anytype1 - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option Anytype1Option { get; private set; } - - /// - /// Gets or Sets Anytype1 - /// - [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } - /// /// Gets or Sets additional properties /// @@ -178,6 +178,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); @@ -185,7 +186,6 @@ public override string ToString() sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); - sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -224,6 +224,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anytype1 = default; Option emptyMap = default; Option>?> mapOfMapProperty = default; Option?> mapProperty = default; @@ -231,7 +232,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader Option mapWithUndeclaredPropertiesAnytype2 = default; Option?> mapWithUndeclaredPropertiesAnytype3 = default; Option?> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -248,6 +248,10 @@ 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)); + break; case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); @@ -276,10 +280,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (utf8JsonReader.TokenType != JsonTokenType.Null) mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -307,7 +307,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); } /// @@ -355,6 +355,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); if (additionalPropertiesClass.EmptyMapOption.IsSet) { writer.WritePropertyName("empty_map"); @@ -390,14 +398,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); } - if (additionalPropertiesClass.Anytype1Option.IsSet) - if (additionalPropertiesClass.Anytype1Option.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs index beb26efb5d47..dd9ac1cb6a3e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Cat.cs @@ -36,10 +36,10 @@ public partial class Cat : Animal, IValidatableObject /// Initializes a new instance of the class. /// /// className - /// declawed /// color (default to "red") + /// declawed [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, Option color = default, Option declawed = default) : base(className, color) { DeclawedOption = declawed; OnCreated(); @@ -98,8 +98,8 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option className = default; - Option declawed = default; Option color = default; + Option declawed = default; while (utf8JsonReader.Read()) { @@ -119,13 +119,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "className": className = new Option(utf8JsonReader.GetString()!); break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) declawed = new Option(utf8JsonReader.GetBoolean()); break; - case "color": - color = new Option(utf8JsonReader.GetString()!); - break; default: break; } @@ -138,13 +138,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed.IsSet && declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value!, declawed, color); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(className.Value!, color, declawed); } /// @@ -179,11 +179,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp writer.WriteString("className", cat.ClassName); - if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); - if (cat.ColorOption.IsSet) writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs index 9215bd87cbca..b2ecc92d82a5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Category.cs @@ -35,24 +35,18 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(Option id = default, string name = @"default-name") { - Name = name; IdOption = id; + Name = name; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Name - /// - [JsonPropertyName("name")] - public string Name { get; set; } - /// /// Used to track the state of Id /// @@ -66,6 +60,12 @@ public Category(string name = @"default-name", Option id = default) [JsonPropertyName("id")] public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + /// /// Gets or Sets additional properties /// @@ -80,8 +80,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -120,8 +120,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -138,13 +138,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; default: break; } @@ -154,13 +154,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (!name.IsSet) throw new ArgumentException("Property is required for class Category.", nameof(name)); - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value!, id); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value!); } /// @@ -190,10 +190,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); + + writer.WriteString("name", category.Name); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs index b848f330b3c2..872db7c62660 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Drawing.cs @@ -36,16 +36,16 @@ public partial class Drawing : Dictionary, IValidatableObject /// Initializes a new instance of the class. /// /// mainShape - /// shapes /// nullableShape /// shapeOrNull + /// shapes [JsonConstructor] - public Drawing(Option mainShape = default, Option?> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option?> shapes = default) : base() { MainShapeOption = mainShape; - ShapesOption = shapes; NullableShapeOption = nullableShape; ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; OnCreated(); } @@ -64,19 +64,6 @@ public Drawing(Option mainShape = default, Option?> shapes = [JsonPropertyName("mainShape")] public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } - /// - /// Used to track the state of Shapes - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ShapesOption { get; private set; } - - /// - /// Gets or Sets Shapes - /// - [JsonPropertyName("shapes")] - public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } - /// /// Used to track the state of NullableShape /// @@ -103,6 +90,19 @@ public Drawing(Option mainShape = default, Option?> shapes = [JsonPropertyName("shapeOrNull")] public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } + /// /// Gets or Sets additional properties /// @@ -119,9 +119,9 @@ public override string ToString() sb.Append("class Drawing {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); sb.Append(" MainShape: ").Append(MainShape).Append("\n"); - sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -171,9 +171,9 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option mainShape = default; - Option?> shapes = default; Option nullableShape = default; Option shapeOrNull = default; + Option?> shapes = default; while (utf8JsonReader.Read()) { @@ -194,10 +194,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -206,6 +202,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; default: break; } @@ -218,7 +218,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); } /// @@ -256,11 +256,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); } - if (drawing.ShapesOption.IsSet) - { - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { @@ -277,6 +272,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs index 3fd5bdb90e2b..e0248de04b9c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/EnumTest.cs @@ -40,22 +40,22 @@ public partial class EnumTest : IValidatableObject /// enumIntegerOnly /// enumNumber /// enumString + /// outerEnum /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue - /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) { EnumStringRequired = enumStringRequired; EnumIntegerOption = enumInteger; EnumIntegerOnlyOption = enumIntegerOnly; EnumNumberOption = enumNumber; EnumStringOption = enumString; + OuterEnumOption = outerEnum; OuterEnumDefaultValueOption = outerEnumDefaultValue; OuterEnumIntegerOption = outerEnumInteger; OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; - OuterEnumOption = outerEnum; OnCreated(); } @@ -603,6 +603,19 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("enum_string")] public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + /// /// Used to track the state of OuterEnumDefaultValue /// @@ -642,19 +655,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("outerEnumIntegerDefaultValue")] public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } - /// - /// Used to track the state of OuterEnum - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option OuterEnumOption { get; private set; } - - /// - /// Gets or Sets OuterEnum - /// - [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -674,10 +674,10 @@ public override string ToString() sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -721,10 +721,10 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv Option enumIntegerOnly = default; Option enumNumber = default; Option enumString = default; + Option outerEnum = default; Option outerEnumDefaultValue = default; Option outerEnumInteger = default; Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -763,6 +763,11 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (enumStringRawValue != null) enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; + case "outerEnum": + string? outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); if (outerEnumDefaultValueRawValue != null) @@ -778,11 +783,6 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValueRawValue != null) outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; - case "outerEnum": - string? outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); - break; default: break; } @@ -816,7 +816,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); } /// @@ -864,6 +864,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string"); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); if (enumTest.OuterEnumDefaultValueOption.IsSet) { var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); @@ -879,14 +887,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) - if (enumTest.OuterEnumOption!.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); - writer.WriteString("outerEnum", outerEnumRawValue); - } - else - writer.WriteNull("outerEnum"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs index 86c6e2914513..e4dd3c1c6837 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/NullableClass.cs @@ -35,9 +35,8 @@ public partial class NullableClass : Dictionary, IValidatableObj /// /// Initializes a new instance of the class. /// - /// arrayItemsNullable - /// objectItemsNullable /// arrayAndItemsNullableProp + /// arrayItemsNullable /// arrayNullableProp /// booleanProp /// dateProp @@ -45,14 +44,14 @@ public partial class NullableClass : Dictionary, IValidatableObj /// integerProp /// numberProp /// objectAndItemsNullableProp + /// objectItemsNullable /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option?> arrayItemsNullable = default, Option?> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(Option?> arrayAndItemsNullableProp = default, Option?> arrayItemsNullable = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectItemsNullable = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullableOption = arrayItemsNullable; - ObjectItemsNullableOption = objectItemsNullable; ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; ArrayNullablePropOption = arrayNullableProp; BooleanPropOption = booleanProp; DatePropOption = dateProp; @@ -60,6 +59,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< IntegerPropOption = integerProp; NumberPropOption = numberProp; ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; ObjectNullablePropOption = objectNullableProp; StringPropOption = stringProp; OnCreated(); @@ -68,43 +68,30 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< partial void OnCreated(); /// - /// Used to track the state of ArrayItemsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ArrayItemsNullableOption { get; private set; } - - /// - /// Gets or Sets ArrayItemsNullable - /// - [JsonPropertyName("array_items_nullable")] - public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectItemsNullable + /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ObjectItemsNullableOption { get; private set; } + public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// - /// Gets or Sets ObjectItemsNullable + /// Gets or Sets ArrayAndItemsNullableProp /// - [JsonPropertyName("object_items_nullable")] - public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + [JsonPropertyName("array_and_items_nullable_prop")] + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// - /// Used to track the state of ArrayAndItemsNullableProp + /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ArrayAndItemsNullablePropOption { get; private set; } + public Option?> ArrayItemsNullableOption { get; private set; } /// - /// Gets or Sets ArrayAndItemsNullableProp + /// Gets or Sets ArrayItemsNullable /// - [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + [JsonPropertyName("array_items_nullable")] + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayNullableProp @@ -197,6 +184,19 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< [JsonPropertyName("object_and_items_nullable_prop")] public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + /// /// Used to track the state of ObjectNullableProp /// @@ -238,9 +238,8 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class NullableClass {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); - sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); - sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); sb.Append(" DateProp: ").Append(DateProp).Append("\n"); @@ -248,6 +247,7 @@ public override string ToString() sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); sb.Append(" StringProp: ").Append(StringProp).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -308,9 +308,8 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayItemsNullable = default; - Option?> objectItemsNullable = default; Option?> arrayAndItemsNullableProp = default; + Option?> arrayItemsNullable = default; Option?> arrayNullableProp = default; Option booleanProp = default; Option dateProp = default; @@ -318,6 +317,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option integerProp = default; Option numberProp = default; Option?> objectAndItemsNullableProp = default; + Option?> objectItemsNullable = default; Option?> objectNullableProp = default; Option stringProp = default; @@ -336,18 +336,14 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { - case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = 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)!); - break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)!); + break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -376,6 +372,10 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)!); + break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -395,7 +395,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); } /// @@ -428,16 +428,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) - { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - } - if (nullableClass.ObjectItemsNullableOption.IsSet) - { - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { @@ -446,6 +436,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { @@ -492,6 +487,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs index b990f5b833ba..fd9c7e70a51c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/Order.cs @@ -35,21 +35,21 @@ public partial class Order : IValidatableObject /// /// Initializes a new instance of the class. /// + /// complete (default to false) /// id /// petId /// quantity /// shipDate /// Order Status - /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) { + CompleteOption = complete; IdOption = id; PetIdOption = petId; QuantityOption = quantity; ShipDateOption = shipDate; StatusOption = status; - CompleteOption = complete; OnCreated(); } @@ -150,6 +150,19 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("status")] public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } + /// /// Used to track the state of Id /// @@ -203,19 +216,6 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("shipDate")] public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } - /// - /// Used to track the state of Complete - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option CompleteOption { get; private set; } - - /// - /// Gets or Sets Complete - /// - [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -230,12 +230,12 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" PetId: ").Append(PetId).Append("\n"); sb.Append(" Quantity: ").Append(Quantity).Append("\n"); sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -279,12 +279,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option complete = default; Option id = default; Option petId = default; Option quantity = default; Option shipDate = default; Option status = default; - Option complete = default; while (utf8JsonReader.Read()) { @@ -301,6 +301,10 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); @@ -322,16 +326,15 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (statusRawValue != null) status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; - case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); - break; default: break; } } } + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); @@ -347,10 +350,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete.IsSet && complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - - return new Order(id, petId, quantity, shipDate, status, complete); + return new Order(complete, id, petId, quantity, shipDate, status); } /// @@ -377,6 +377,9 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); + if (order.IdOption.IsSet) writer.WriteNumber("id", order.IdOption.Value!.Value); @@ -394,9 +397,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializ writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - - if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs index 5b38fc58828f..21ebb68608f3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/RequiredClass.cs @@ -46,17 +46,6 @@ public partial class RequiredClass : IValidatableObject /// requiredNotnullableStringProp /// requiredNotnullableUuid /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid /// requiredNullableArrayOfString /// requiredNullableBooleanProp /// requiredNullableDateProp @@ -68,8 +57,19 @@ public partial class RequiredClass : IValidatableObject /// requiredNullableOuterEnumDefaultValue /// requiredNullableStringProp /// requiredNullableUuid + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp /// notRequiredNullableDateProp /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid /// notrequiredNullableArrayOfString /// notrequiredNullableBooleanProp /// notrequiredNullableDatetimeProp @@ -80,7 +80,7 @@ public partial class RequiredClass : IValidatableObject /// notrequiredNullableStringProp /// notrequiredNullableUuid [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) { RequiredNotNullableDateProp = requiredNotNullableDateProp; RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; @@ -93,17 +93,6 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNotnullableStringProp = requiredNotnullableStringProp; RequiredNotnullableUuid = requiredNotnullableUuid; RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; RequiredNullableArrayOfString = requiredNullableArrayOfString; RequiredNullableBooleanProp = requiredNullableBooleanProp; RequiredNullableDateProp = requiredNullableDateProp; @@ -115,8 +104,19 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; RequiredNullableStringProp = requiredNullableStringProp; RequiredNullableUuid = requiredNullableUuid; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; NotRequiredNullableDatePropOption = notRequiredNullableDateProp; NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; @@ -424,9 +424,9 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// - /// Defines NotrequiredNotnullableEnumInteger + /// Defines RequiredNullableEnumInteger /// - public enum NotrequiredNotnullableEnumIntegerEnum + public enum RequiredNullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -440,65 +440,58 @@ public enum NotrequiredNotnullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumInteger - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger + /// Gets or Sets RequiredNullableEnumInteger /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// - /// Defines NotrequiredNotnullableEnumIntegerOnly + /// Defines RequiredNullableEnumIntegerOnly /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum + public enum RequiredNullableEnumIntegerOnlyEnum { /// /// Enum NUMBER_2 for value: 2 @@ -512,65 +505,58 @@ public enum NotrequiredNotnullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// Gets or Sets RequiredNullableEnumIntegerOnly /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// - /// Defines NotrequiredNotnullableEnumString + /// Defines RequiredNullableEnumString /// - public enum NotrequiredNotnullableEnumStringEnum + public enum RequiredNullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -614,139 +600,128 @@ public enum NotrequiredNotnullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) return "UPPER"; - if (value == NotrequiredNotnullableEnumStringEnum.Lower) + if (value == RequiredNullableEnumStringEnum.Lower) return "lower"; - if (value == NotrequiredNotnullableEnumStringEnum.Empty) + if (value == RequiredNullableEnumStringEnum.Empty) return ""; - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + if (value == RequiredNullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Used to track the state of NotrequiredNotnullableEnumString - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } - - /// - /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableEnumString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// - /// Defines RequiredNullableEnumInteger + /// Defines NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerEnum + public enum NotrequiredNotnullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -760,61 +735,68 @@ public enum RequiredNullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumInteger + /// Used to track the state of NotrequiredNotnullableEnumInteger /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// - /// Defines RequiredNullableEnumIntegerOnly + /// Gets or Sets NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 /// NUMBER_2 = 2, @@ -825,58 +807,65 @@ public enum RequiredNullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumIntegerOnly + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// - /// Defines RequiredNullableEnumString + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// - public enum RequiredNullableEnumStringEnum + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -920,123 +909,134 @@ public enum RequiredNullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) return "UPPER"; - if (value == RequiredNullableEnumStringEnum.Lower) + if (value == NotrequiredNotnullableEnumStringEnum.Lower) return "lower"; - if (value == RequiredNullableEnumStringEnum.Empty) + if (value == NotrequiredNotnullableEnumStringEnum.Empty) return ""; - if (value == RequiredNullableEnumStringEnum.ValuewithTab) + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Gets or Sets RequiredNullableEnumString + /// Used to track the state of NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// Gets or Sets NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines NotrequiredNullableEnumInteger @@ -1405,165 +1405,165 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu public int RequiredNotnullableintegerProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableArrayOfString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableDatePropOption { get; private set; } + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } /// - /// Gets or Sets NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableBooleanProp /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDateProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } /// - /// Gets or Sets NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDatetimeProp /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableIntegerProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } /// - /// Gets or Sets NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableStringProp /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableBooleanProp + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableBooleanProp + /// Gets or Sets NotRequiredNotnullableDateProp /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// Gets or Sets NotRequiredNotnullableintegerProp /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableStringProp + /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableStringPropOption { get; private set; } + public Option NotRequiredNullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableStringProp + /// Gets or Sets NotRequiredNullableDateProp /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableUuid + /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableUuidOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableArrayOfString + /// Gets or Sets NotRequiredNullableIntegerProp /// - [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableBooleanProp + /// Used to track the state of NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// - /// Gets or Sets RequiredNullableDatetimeProp + /// Used to track the state of NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableStringProp + /// Used to track the state of NotrequiredNotnullableDatetimeProp /// - [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// - /// Gets or Sets RequiredNullableUuid + /// Gets or Sets NotrequiredNotnullableDatetimeProp /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableDateProp + /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableDatePropOption { get; private set; } + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableStringProp /// - [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableIntegerProp + /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableIntegerPropOption { get; private set; } + public Option NotrequiredNotnullableUuidOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableUuid /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString @@ -1656,17 +1656,6 @@ public override string ToString() sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); @@ -1678,8 +1667,19 @@ public override string ToString() sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); @@ -1720,16 +1720,6 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// /// The format to use to serialize RequiredNullableDateProp /// @@ -1740,11 +1730,21 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// /// The format to use to serialize NotRequiredNullableDateProp /// public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// /// The format to use to serialize NotrequiredNullableDatetimeProp /// @@ -1778,17 +1778,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNotnullableStringProp = default; Option requiredNotnullableUuid = default; Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option?> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; Option?> requiredNullableArrayOfString = default; Option requiredNullableBooleanProp = default; Option requiredNullableDateProp = default; @@ -1800,8 +1789,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNullableOuterEnumDefaultValue = default; Option requiredNullableStringProp = default; Option requiredNullableUuid = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; Option notRequiredNullableDateProp = default; Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; Option?> notrequiredNullableArrayOfString = default; Option notrequiredNullableBooleanProp = default; Option notrequiredNullableDatetimeProp = default; @@ -1872,51 +1872,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; case "required_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -1962,6 +1917,14 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; case "not_required_nullable_date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -1970,6 +1933,43 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; case "notrequired_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -2145,7 +2145,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2211,46 +2211,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); - - if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); - - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) - { - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - } - if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); - - if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); - - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); - - if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); - if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); @@ -2315,6 +2275,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); @@ -2327,6 +2293,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs index 9de7d2a95683..c36799b77ed7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt-useSourceGeneration/src/UseSourceGeneration/Model/User.cs @@ -35,38 +35,66 @@ public partial class User : IValidatableObject /// /// Initializes a new instance of the class. /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// email /// firstName /// id /// lastName /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// password /// phone /// User Status /// username - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; EmailOption = email; FirstNameOption = firstName; IdOption = id; LastNameOption = lastName; ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; PasswordOption = password; PhoneOption = phone; UserStatusOption = userStatus; UsernameOption = username; - AnyTypePropOption = anyTypeProp; - AnyTypePropNullableOption = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + [JsonPropertyName("anyTypeProp")] + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + [JsonPropertyName("anyTypePropNullable")] + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + /// /// Used to track the state of Email /// @@ -133,6 +161,20 @@ public User(Option email = default, Option firstName = default [JsonPropertyName("objectWithNoDeclaredProps")] public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + /// /// Used to track the state of Password /// @@ -186,48 +228,6 @@ public User(Option email = default, Option firstName = default [JsonPropertyName("username")] public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } - /// - /// Used to track the state of AnyTypeProp - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } - - /// - /// Used to track the state of AnyTypePropNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropNullableOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectWithNoDeclaredPropsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } - - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -242,18 +242,18 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" FirstName: ").Append(FirstName).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" LastName: ").Append(LastName).Append("\n"); sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); - sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); - sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -292,18 +292,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anyTypeProp = default; + Option anyTypePropNullable = default; Option email = default; Option firstName = default; Option id = default; Option lastName = default; Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; Option password = default; Option phone = default; Option userStatus = default; Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -320,6 +320,14 @@ 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)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "email": email = new Option(utf8JsonReader.GetString()!); break; @@ -337,6 +345,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (utf8JsonReader.TokenType != JsonTokenType.Null) objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "password": password = new Option(utf8JsonReader.GetString()!); break; @@ -350,18 +362,6 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "username": username = new Option(utf8JsonReader.GetString()!); break; - case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -395,7 +395,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); } /// @@ -443,6 +443,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet && user.Username == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); if (user.EmailOption.IsSet) writer.WriteString("email", user.Email); @@ -460,6 +476,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); @@ -471,31 +495,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet) writer.WriteString("username", user.Username); - - if (user.AnyTypePropOption.IsSet) - if (user.AnyTypePropOption.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) - if (user.AnyTypePropNullableOption.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) - if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/AdditionalPropertiesClass.md index f79869f95a71..2bbe882fcfcc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/AdditionalPropertiesClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/AdditionalPropertiesClass.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] **EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] **MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapProperty** | **Dictionary<string, string>** | | [optional] @@ -11,7 +12,6 @@ Name | Type | Description | Notes **MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] **MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] **MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] -**Anytype1** | **Object** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Drawing.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Drawing.md index 215793515f64..95f49b2ed600 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Drawing.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Drawing.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MainShape** | [**Shape**](Shape.md) | | [optional] -**Shapes** | [**List<Shape>**](Shape.md) | | [optional] **NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] **ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md index 470701a32abc..ebd7ccf2c864 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/EnumTest.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] -**OuterEnum** | **OuterEnum** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/NullableClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/NullableClass.md index 394feef77dbb..5d9965f55c0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/NullableClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/NullableClass.md @@ -4,9 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ArrayItemsNullable** | **List<Object>** | | [optional] -**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] **ArrayNullableProp** | **List<Object>** | | [optional] **BooleanProp** | **bool** | | [optional] **DateProp** | **DateTime** | | [optional] @@ -14,6 +13,7 @@ Name | Type | Description | Notes **IntegerProp** | **int** | | [optional] **NumberProp** | **decimal** | | [optional] **ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] **StringProp** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Order.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Order.md index ca5d8992a513..f7d6827ed5c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Order.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/Order.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] **Id** | **long** | | [optional] **PetId** | **long** | | [optional] **Quantity** | **int** | | [optional] **ShipDate** | **DateTime** | | [optional] **Status** | **string** | Order Status | [optional] -**Complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md index 5ff4cb1b73cc..8f148be840b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/RequiredClass.md @@ -15,17 +15,6 @@ Name | Type | Description | Notes **RequiredNotnullableStringProp** | **string** | | **RequiredNotnullableUuid** | **Guid** | | **RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] **RequiredNullableArrayOfString** | **List<string>** | | **RequiredNullableBooleanProp** | **bool** | | **RequiredNullableDateProp** | **DateTime** | | @@ -37,8 +26,19 @@ Name | Type | Description | Notes **RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | **RequiredNullableStringProp** | **string** | | **RequiredNullableUuid** | **Guid** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] **NotRequiredNullableDateProp** | **DateTime** | | [optional] **NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] **NotrequiredNullableArrayOfString** | **List<string>** | | [optional] **NotrequiredNullableBooleanProp** | **bool** | | [optional] **NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/User.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/User.md index 455f031674d5..b5700f1c75d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/User.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/docs/models/User.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] **Email** | **string** | | [optional] **FirstName** | **string** | | [optional] **Id** | **long** | | [optional] **LastName** | **string** | | [optional] **ObjectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] **Password** | **string** | | [optional] **Phone** | **string** | | [optional] **UserStatus** | **int** | User Status | [optional] **Username** | **string** | | [optional] -**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] -**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] -**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs index e3234dee5bb2..e37ccad59131 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -175,18 +175,18 @@ public static string SanitizeFilename(string filename) return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index bb63ed9b07d8..d373bc67722e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -34,6 +34,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// /// Initializes a new instance of the class. /// + /// anytype1 /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// mapOfMapProperty /// mapProperty @@ -41,10 +42,10 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesAnytype2 /// mapWithUndeclaredPropertiesAnytype3 /// mapWithUndeclaredPropertiesString - /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>?> mapOfMapProperty = default, Option?> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option?> mapWithUndeclaredPropertiesAnytype3 = default, Option?> mapWithUndeclaredPropertiesString = default) { + Anytype1Option = anytype1; EmptyMapOption = emptyMap; MapOfMapPropertyOption = mapOfMapProperty; MapPropertyOption = mapProperty; @@ -52,12 +53,24 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } + /// /// Used to track the state of EmptyMap /// @@ -150,19 +163,6 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option? MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } - /// - /// Used to track the state of Anytype1 - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option Anytype1Option { get; private set; } - - /// - /// Gets or Sets Anytype1 - /// - [JsonPropertyName("anytype_1")] - public Object? Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } - /// /// Gets or Sets additional properties /// @@ -177,6 +177,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); @@ -184,7 +185,6 @@ public override string ToString() sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); - sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -223,6 +223,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anytype1 = default; Option emptyMap = default; Option>?> mapOfMapProperty = default; Option?> mapProperty = default; @@ -230,7 +231,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader Option mapWithUndeclaredPropertiesAnytype2 = default; Option?> mapWithUndeclaredPropertiesAnytype3 = default; Option?> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -247,6 +247,10 @@ 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)); + break; case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); @@ -275,10 +279,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (utf8JsonReader.TokenType != JsonTokenType.Null) mapWithUndeclaredPropertiesString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -306,7 +306,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); } /// @@ -354,6 +354,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); if (additionalPropertiesClass.EmptyMapOption.IsSet) { writer.WritePropertyName("empty_map"); @@ -389,14 +397,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); } - if (additionalPropertiesClass.Anytype1Option.IsSet) - if (additionalPropertiesClass.Anytype1Option.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs index b9b7df79bd3f..b914d1dd4d6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Cat.cs @@ -35,10 +35,10 @@ public partial class Cat : Animal, IValidatableObject /// Initializes a new instance of the class. /// /// className - /// declawed /// color (default to "red") + /// declawed [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, Option color = default, Option declawed = default) : base(className, color) { DeclawedOption = declawed; OnCreated(); @@ -97,8 +97,8 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option className = default; - Option declawed = default; Option color = default; + Option declawed = default; while (utf8JsonReader.Read()) { @@ -118,13 +118,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "className": className = new Option(utf8JsonReader.GetString()!); break; + case "color": + color = new Option(utf8JsonReader.GetString()!); + break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) declawed = new Option(utf8JsonReader.GetBoolean()); break; - case "color": - color = new Option(utf8JsonReader.GetString()!); - break; default: break; } @@ -137,13 +137,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed.IsSet && declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value!, declawed, color); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(className.Value!, color, declawed); } /// @@ -178,11 +178,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp writer.WriteString("className", cat.ClassName); - if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); - if (cat.ColorOption.IsSet) writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs index 1050f942fdf5..55a7984769bc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Category.cs @@ -34,24 +34,18 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(Option id = default, string name = @"default-name") { - Name = name; IdOption = id; + Name = name; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Name - /// - [JsonPropertyName("name")] - public string Name { get; set; } - /// /// Used to track the state of Id /// @@ -65,6 +59,12 @@ public Category(string name = @"default-name", Option id = default) [JsonPropertyName("id")] public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + /// /// Gets or Sets additional properties /// @@ -79,8 +79,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -119,8 +119,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -137,13 +137,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()!); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); break; + case "name": + name = new Option(utf8JsonReader.GetString()!); + break; default: break; } @@ -153,13 +153,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (!name.IsSet) throw new ArgumentException("Property is required for class Category.", nameof(name)); - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value!, id); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value!); } /// @@ -189,10 +189,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value!.Value); + + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs index 47a2babf5c12..3fd22bea8786 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Drawing.cs @@ -35,16 +35,16 @@ public partial class Drawing : Dictionary, IValidatableObject /// Initializes a new instance of the class. /// /// mainShape - /// shapes /// nullableShape /// shapeOrNull + /// shapes [JsonConstructor] - public Drawing(Option mainShape = default, Option?> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option?> shapes = default) : base() { MainShapeOption = mainShape; - ShapesOption = shapes; NullableShapeOption = nullableShape; ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; OnCreated(); } @@ -63,19 +63,6 @@ public Drawing(Option mainShape = default, Option?> shapes = [JsonPropertyName("mainShape")] public Shape? MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } - /// - /// Used to track the state of Shapes - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ShapesOption { get; private set; } - - /// - /// Gets or Sets Shapes - /// - [JsonPropertyName("shapes")] - public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } - /// /// Used to track the state of NullableShape /// @@ -102,6 +89,19 @@ public Drawing(Option mainShape = default, Option?> shapes = [JsonPropertyName("shapeOrNull")] public ShapeOrNull? ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List? Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } + /// /// Gets or Sets additional properties /// @@ -118,9 +118,9 @@ public override string ToString() sb.Append("class Drawing {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); sb.Append(" MainShape: ").Append(MainShape).Append("\n"); - sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -170,9 +170,9 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option mainShape = default; - Option?> shapes = default; Option nullableShape = default; Option shapeOrNull = default; + Option?> shapes = default; while (utf8JsonReader.Read()) { @@ -193,10 +193,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; - case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -205,6 +201,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; default: break; } @@ -217,7 +217,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); } /// @@ -255,11 +255,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); } - if (drawing.ShapesOption.IsSet) - { - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { @@ -276,6 +271,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs index facd29905472..25b336639304 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/EnumTest.cs @@ -39,22 +39,22 @@ public partial class EnumTest : IValidatableObject /// enumIntegerOnly /// enumNumber /// enumString + /// outerEnum /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue - /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) { EnumStringRequired = enumStringRequired; EnumIntegerOption = enumInteger; EnumIntegerOnlyOption = enumIntegerOnly; EnumNumberOption = enumNumber; EnumStringOption = enumString; + OuterEnumOption = outerEnum; OuterEnumDefaultValueOption = outerEnumDefaultValue; OuterEnumIntegerOption = outerEnumInteger; OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; - OuterEnumOption = outerEnum; OnCreated(); } @@ -602,6 +602,19 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("enum_string")] public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + /// /// Used to track the state of OuterEnumDefaultValue /// @@ -641,19 +654,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("outerEnumIntegerDefaultValue")] public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } - /// - /// Used to track the state of OuterEnum - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option OuterEnumOption { get; private set; } - - /// - /// Gets or Sets OuterEnum - /// - [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -673,10 +673,10 @@ public override string ToString() sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -720,10 +720,10 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv Option enumIntegerOnly = default; Option enumNumber = default; Option enumString = default; + Option outerEnum = default; Option outerEnumDefaultValue = default; Option outerEnumInteger = default; Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -762,6 +762,11 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (enumStringRawValue != null) enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; + case "outerEnum": + string? outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; case "outerEnumDefaultValue": string? outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); if (outerEnumDefaultValueRawValue != null) @@ -777,11 +782,6 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValueRawValue != null) outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; - case "outerEnum": - string? outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); - break; default: break; } @@ -815,7 +815,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); + return new EnumTest(enumStringRequired.Value!.Value!, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); } /// @@ -863,6 +863,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string"); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption!.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); if (enumTest.OuterEnumDefaultValueOption.IsSet) { var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue!.Value); @@ -878,14 +886,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue!.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) - if (enumTest.OuterEnumOption!.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value!.Value); - writer.WriteString("outerEnum", outerEnumRawValue); - } - else - writer.WriteNull("outerEnum"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs index 29883550a98e..8b33b92c4685 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/NullableClass.cs @@ -34,9 +34,8 @@ public partial class NullableClass : Dictionary, IValidatableObj /// /// Initializes a new instance of the class. /// - /// arrayItemsNullable - /// objectItemsNullable /// arrayAndItemsNullableProp + /// arrayItemsNullable /// arrayNullableProp /// booleanProp /// dateProp @@ -44,14 +43,14 @@ public partial class NullableClass : Dictionary, IValidatableObj /// integerProp /// numberProp /// objectAndItemsNullableProp + /// objectItemsNullable /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option?> arrayItemsNullable = default, Option?> objectItemsNullable = default, Option?> arrayAndItemsNullableProp = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(Option?> arrayAndItemsNullableProp = default, Option?> arrayItemsNullable = default, Option?> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option?> objectAndItemsNullableProp = default, Option?> objectItemsNullable = default, Option?> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullableOption = arrayItemsNullable; - ObjectItemsNullableOption = objectItemsNullable; ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; ArrayNullablePropOption = arrayNullableProp; BooleanPropOption = booleanProp; DatePropOption = dateProp; @@ -59,6 +58,7 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< IntegerPropOption = integerProp; NumberPropOption = numberProp; ObjectAndItemsNullablePropOption = objectAndItemsNullableProp; + ObjectItemsNullableOption = objectItemsNullable; ObjectNullablePropOption = objectNullableProp; StringPropOption = stringProp; OnCreated(); @@ -67,43 +67,30 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< partial void OnCreated(); /// - /// Used to track the state of ArrayItemsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ArrayItemsNullableOption { get; private set; } - - /// - /// Gets or Sets ArrayItemsNullable - /// - [JsonPropertyName("array_items_nullable")] - public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectItemsNullable + /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ObjectItemsNullableOption { get; private set; } + public Option?> ArrayAndItemsNullablePropOption { get; private set; } /// - /// Gets or Sets ObjectItemsNullable + /// Gets or Sets ArrayAndItemsNullableProp /// - [JsonPropertyName("object_items_nullable")] - public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + [JsonPropertyName("array_and_items_nullable_prop")] + public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// - /// Used to track the state of ArrayAndItemsNullableProp + /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> ArrayAndItemsNullablePropOption { get; private set; } + public Option?> ArrayItemsNullableOption { get; private set; } /// - /// Gets or Sets ArrayAndItemsNullableProp + /// Gets or Sets ArrayItemsNullable /// - [JsonPropertyName("array_and_items_nullable_prop")] - public List? ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + [JsonPropertyName("array_items_nullable")] + public List? ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayNullableProp @@ -196,6 +183,19 @@ public NullableClass(Option?> arrayItemsNullable = default, Option< [JsonPropertyName("object_and_items_nullable_prop")] public Dictionary? ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary? ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + /// /// Used to track the state of ObjectNullableProp /// @@ -237,9 +237,8 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class NullableClass {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); - sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); - sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); sb.Append(" DateProp: ").Append(DateProp).Append("\n"); @@ -247,6 +246,7 @@ public override string ToString() sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); sb.Append(" StringProp: ").Append(StringProp).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -307,9 +307,8 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option?> arrayItemsNullable = default; - Option?> objectItemsNullable = default; Option?> arrayAndItemsNullableProp = default; + Option?> arrayItemsNullable = default; Option?> arrayNullableProp = default; Option booleanProp = default; Option dateProp = default; @@ -317,6 +316,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option integerProp = default; Option numberProp = default; Option?> objectAndItemsNullableProp = default; + Option?> objectItemsNullable = default; Option?> objectNullableProp = default; Option stringProp = default; @@ -335,18 +335,14 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { - case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = 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)!); - break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)!); + break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) arrayNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -375,6 +371,10 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)!); + break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) objectNullableProp = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -394,7 +394,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); } /// @@ -427,16 +427,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) - { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - } - if (nullableClass.ObjectItemsNullableOption.IsSet) - { - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { @@ -445,6 +435,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { @@ -491,6 +486,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs index 29c2446d9494..7b771cdc8b54 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/Order.cs @@ -34,21 +34,21 @@ public partial class Order : IValidatableObject /// /// Initializes a new instance of the class. /// + /// complete (default to false) /// id /// petId /// quantity /// shipDate /// Order Status - /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) { + CompleteOption = complete; IdOption = id; PetIdOption = petId; QuantityOption = quantity; ShipDateOption = shipDate; StatusOption = status; - CompleteOption = complete; OnCreated(); } @@ -149,6 +149,19 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("status")] public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } + /// /// Used to track the state of Id /// @@ -202,19 +215,6 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("shipDate")] public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } - /// - /// Used to track the state of Complete - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option CompleteOption { get; private set; } - - /// - /// Gets or Sets Complete - /// - [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -229,12 +229,12 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" PetId: ").Append(PetId).Append("\n"); sb.Append(" Quantity: ").Append(Quantity).Append("\n"); sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -278,12 +278,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option complete = default; Option id = default; Option petId = default; Option quantity = default; Option shipDate = default; Option status = default; - Option complete = default; while (utf8JsonReader.Read()) { @@ -300,6 +300,10 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); @@ -321,16 +325,15 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (statusRawValue != null) status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; - case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); - break; default: break; } } } + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); @@ -346,10 +349,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete.IsSet && complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - - return new Order(id, petId, quantity, shipDate, status, complete); + return new Order(complete, id, petId, quantity, shipDate, status); } /// @@ -376,6 +376,9 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); + if (order.IdOption.IsSet) writer.WriteNumber("id", order.IdOption.Value!.Value); @@ -393,9 +396,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializ writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - - if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value!.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs index 81f473a03e21..1ab35bd5ff68 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -45,17 +45,6 @@ public partial class RequiredClass : IValidatableObject /// requiredNotnullableStringProp /// requiredNotnullableUuid /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid /// requiredNullableArrayOfString /// requiredNullableBooleanProp /// requiredNullableDateProp @@ -67,8 +56,19 @@ public partial class RequiredClass : IValidatableObject /// requiredNullableOuterEnumDefaultValue /// requiredNullableStringProp /// requiredNullableUuid + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp /// notRequiredNullableDateProp /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid /// notrequiredNullableArrayOfString /// notrequiredNullableBooleanProp /// notrequiredNullableDatetimeProp @@ -79,7 +79,7 @@ public partial class RequiredClass : IValidatableObject /// notrequiredNullableStringProp /// notrequiredNullableUuid [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List? requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string? requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option?> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option?> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) { RequiredNotNullableDateProp = requiredNotNullableDateProp; RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; @@ -92,17 +92,6 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNotnullableStringProp = requiredNotnullableStringProp; RequiredNotnullableUuid = requiredNotnullableUuid; RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; RequiredNullableArrayOfString = requiredNullableArrayOfString; RequiredNullableBooleanProp = requiredNullableBooleanProp; RequiredNullableDateProp = requiredNullableDateProp; @@ -114,8 +103,19 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; RequiredNullableStringProp = requiredNullableStringProp; RequiredNullableUuid = requiredNullableUuid; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; NotRequiredNullableDatePropOption = notRequiredNullableDateProp; NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; @@ -423,9 +423,9 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// - /// Defines NotrequiredNotnullableEnumInteger + /// Defines RequiredNullableEnumInteger /// - public enum NotrequiredNotnullableEnumIntegerEnum + public enum RequiredNullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -439,65 +439,58 @@ public enum NotrequiredNotnullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumInteger - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger + /// Gets or Sets RequiredNullableEnumInteger /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// - /// Defines NotrequiredNotnullableEnumIntegerOnly + /// Defines RequiredNullableEnumIntegerOnly /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum + public enum RequiredNullableEnumIntegerOnlyEnum { /// /// Enum NUMBER_2 for value: 2 @@ -511,65 +504,58 @@ public enum NotrequiredNotnullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// Gets or Sets RequiredNullableEnumIntegerOnly /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// - /// Defines NotrequiredNotnullableEnumString + /// Defines RequiredNullableEnumString /// - public enum NotrequiredNotnullableEnumStringEnum + public enum RequiredNullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -613,139 +599,128 @@ public enum NotrequiredNotnullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) return "UPPER"; - if (value == NotrequiredNotnullableEnumStringEnum.Lower) + if (value == RequiredNullableEnumStringEnum.Lower) return "lower"; - if (value == NotrequiredNotnullableEnumStringEnum.Empty) + if (value == RequiredNullableEnumStringEnum.Empty) return ""; - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + if (value == RequiredNullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Used to track the state of NotrequiredNotnullableEnumString - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } - - /// - /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableEnumString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// - /// Defines RequiredNullableEnumInteger + /// Defines NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerEnum + public enum NotrequiredNotnullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -759,61 +734,68 @@ public enum RequiredNullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumInteger + /// Used to track the state of NotrequiredNotnullableEnumInteger /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// - /// Defines RequiredNullableEnumIntegerOnly + /// Gets or Sets NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 /// NUMBER_2 = 2, @@ -824,58 +806,65 @@ public enum RequiredNullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumIntegerOnly + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// - /// Defines RequiredNullableEnumString + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// - public enum RequiredNullableEnumStringEnum + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -919,123 +908,134 @@ public enum RequiredNullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string? RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) return "UPPER"; - if (value == RequiredNullableEnumStringEnum.Lower) + if (value == NotrequiredNotnullableEnumStringEnum.Lower) return "lower"; - if (value == RequiredNullableEnumStringEnum.Empty) + if (value == NotrequiredNotnullableEnumStringEnum.Empty) return ""; - if (value == RequiredNullableEnumStringEnum.ValuewithTab) + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Gets or Sets RequiredNullableEnumString + /// Used to track the state of NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// Gets or Sets NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines NotrequiredNullableEnumInteger @@ -1404,165 +1404,165 @@ public static NotrequiredNullableEnumStringEnum NotrequiredNullableEnumStringEnu public int RequiredNotnullableintegerProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableArrayOfString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableDatePropOption { get; private set; } + [JsonPropertyName("required_nullable_array_of_string")] + public List? RequiredNullableArrayOfString { get; set; } /// - /// Gets or Sets NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableBooleanProp /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDateProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } /// - /// Gets or Sets NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDatetimeProp /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableIntegerProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } /// - /// Gets or Sets NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableStringProp /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + [JsonPropertyName("required_nullable_string_prop")] + public string? RequiredNullableStringProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableBooleanProp + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableBooleanProp + /// Gets or Sets NotRequiredNotnullableDateProp /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// Gets or Sets NotRequiredNotnullableintegerProp /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableStringProp + /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableStringPropOption { get; private set; } + public Option NotRequiredNullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableStringProp + /// Gets or Sets NotRequiredNullableDateProp /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableUuid + /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableUuidOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableArrayOfString + /// Gets or Sets NotRequiredNullableIntegerProp /// - [JsonPropertyName("required_nullable_array_of_string")] - public List? RequiredNullableArrayOfString { get; set; } + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableBooleanProp + /// Used to track the state of NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option?> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List? NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// - /// Gets or Sets RequiredNullableDatetimeProp + /// Used to track the state of NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableStringProp + /// Used to track the state of NotrequiredNotnullableDatetimeProp /// - [JsonPropertyName("required_nullable_string_prop")] - public string? RequiredNullableStringProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// - /// Gets or Sets RequiredNullableUuid + /// Gets or Sets NotrequiredNotnullableDatetimeProp /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableDateProp + /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableDatePropOption { get; private set; } + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableStringProp /// - [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string? NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableIntegerProp + /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableIntegerPropOption { get; private set; } + public Option NotrequiredNotnullableUuidOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableUuid /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString @@ -1655,17 +1655,6 @@ public override string ToString() sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); @@ -1677,8 +1666,19 @@ public override string ToString() sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); @@ -1719,16 +1719,6 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// /// The format to use to serialize RequiredNullableDateProp /// @@ -1739,11 +1729,21 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// /// The format to use to serialize NotRequiredNullableDateProp /// public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// /// The format to use to serialize NotrequiredNullableDatetimeProp /// @@ -1777,17 +1777,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNotnullableStringProp = default; Option requiredNotnullableUuid = default; Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option?> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; Option?> requiredNullableArrayOfString = default; Option requiredNullableBooleanProp = default; Option requiredNullableDateProp = default; @@ -1799,8 +1788,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNullableOuterEnumDefaultValue = default; Option requiredNullableStringProp = default; Option requiredNullableUuid = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; Option notRequiredNullableDateProp = default; Option notRequiredNullableIntegerProp = default; + Option?> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; Option?> notrequiredNullableArrayOfString = default; Option notrequiredNullableBooleanProp = default; Option notrequiredNullableDatetimeProp = default; @@ -1871,51 +1871,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; case "required_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -1961,6 +1916,14 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; case "not_required_nullable_date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -1969,6 +1932,43 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)!); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string? notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string? notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()!); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; case "notrequired_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) notrequiredNullableArrayOfString = new Option?>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -2144,7 +2144,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + return new RequiredClass(requiredNotNullableDateProp.Value!.Value!, requiredNotnullableArrayOfString.Value!, requiredNotnullableBooleanProp.Value!.Value!, requiredNotnullableDatetimeProp.Value!.Value!, requiredNotnullableEnumInteger.Value!.Value!, requiredNotnullableEnumIntegerOnly.Value!.Value!, requiredNotnullableEnumString.Value!.Value!, requiredNotnullableOuterEnumDefaultValue.Value!.Value!, requiredNotnullableStringProp.Value!, requiredNotnullableUuid.Value!.Value!, requiredNotnullableintegerProp.Value!.Value!, requiredNullableArrayOfString.Value!, requiredNullableBooleanProp.Value!, requiredNullableDateProp.Value!, requiredNullableDatetimeProp.Value!, requiredNullableEnumInteger.Value!, requiredNullableEnumIntegerOnly.Value!, requiredNullableEnumString.Value!, requiredNullableIntegerProp.Value!, requiredNullableOuterEnumDefaultValue.Value!, requiredNullableStringProp.Value!, requiredNullableUuid.Value!, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2210,46 +2210,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); - - if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); - - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) - { - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - } - if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); - - if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); - - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); - - if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); - if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); @@ -2314,6 +2274,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value!.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value!.Value); + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value!.Value.ToString(NotRequiredNullableDatePropFormat)); @@ -2326,6 +2292,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value!.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value!.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value!.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value!.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value!.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue!.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value!.Value); + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs index 5e7874cc86ab..64db3e2f4623 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0-nrt/src/Org.OpenAPITools/Model/User.cs @@ -34,38 +34,66 @@ public partial class User : IValidatableObject /// /// Initializes a new instance of the class. /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// email /// firstName /// id /// lastName /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// password /// phone /// User Status /// username - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; EmailOption = email; FirstNameOption = firstName; IdOption = id; LastNameOption = lastName; ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; PasswordOption = password; PhoneOption = phone; UserStatusOption = userStatus; UsernameOption = username; - AnyTypePropOption = anyTypeProp; - AnyTypePropNullableOption = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + [JsonPropertyName("anyTypeProp")] + public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + [JsonPropertyName("anyTypePropNullable")] + public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + /// /// Used to track the state of Email /// @@ -132,6 +160,20 @@ public User(Option email = default, Option firstName = default [JsonPropertyName("objectWithNoDeclaredProps")] public Object? ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + /// /// Used to track the state of Password /// @@ -185,48 +227,6 @@ public User(Option email = default, Option firstName = default [JsonPropertyName("username")] public string? Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } - /// - /// Used to track the state of AnyTypeProp - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - [JsonPropertyName("anyTypeProp")] - public Object? AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } - - /// - /// Used to track the state of AnyTypePropNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropNullableOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - [JsonPropertyName("anyTypePropNullable")] - public Object? AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectWithNoDeclaredPropsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } - - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object? ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -241,18 +241,18 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" FirstName: ").Append(FirstName).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" LastName: ").Append(LastName).Append("\n"); sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); - sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); - sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -291,18 +291,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anyTypeProp = default; + Option anyTypePropNullable = default; Option email = default; Option firstName = default; Option id = default; Option lastName = default; Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; Option password = default; Option phone = default; Option userStatus = default; Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -319,6 +319,14 @@ 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)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "email": email = new Option(utf8JsonReader.GetString()!); break; @@ -336,6 +344,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (utf8JsonReader.TokenType != JsonTokenType.Null) objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)!); break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "password": password = new Option(utf8JsonReader.GetString()!); break; @@ -349,18 +361,6 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "username": username = new Option(utf8JsonReader.GetString()!); break; - case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -394,7 +394,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); } /// @@ -442,6 +442,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet && user.Username == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); if (user.EmailOption.IsSet) writer.WriteString("email", user.Email); @@ -459,6 +475,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); @@ -470,31 +494,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet) writer.WriteString("username", user.Username); - - if (user.AnyTypePropOption.IsSet) - if (user.AnyTypePropOption.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) - if (user.AnyTypePropNullableOption.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) - if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/AdditionalPropertiesClass.md index f79869f95a71..2bbe882fcfcc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/AdditionalPropertiesClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/AdditionalPropertiesClass.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] **EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] **MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapProperty** | **Dictionary<string, string>** | | [optional] @@ -11,7 +12,6 @@ Name | Type | Description | Notes **MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] **MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] **MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] -**Anytype1** | **Object** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Drawing.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Drawing.md index 215793515f64..95f49b2ed600 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Drawing.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Drawing.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MainShape** | [**Shape**](Shape.md) | | [optional] -**Shapes** | [**List<Shape>**](Shape.md) | | [optional] **NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] **ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md index 470701a32abc..ebd7ccf2c864 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/EnumTest.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] -**OuterEnum** | **OuterEnum** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/NullableClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/NullableClass.md index 394feef77dbb..5d9965f55c0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/NullableClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/NullableClass.md @@ -4,9 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ArrayItemsNullable** | **List<Object>** | | [optional] -**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] **ArrayNullableProp** | **List<Object>** | | [optional] **BooleanProp** | **bool** | | [optional] **DateProp** | **DateTime** | | [optional] @@ -14,6 +13,7 @@ Name | Type | Description | Notes **IntegerProp** | **int** | | [optional] **NumberProp** | **decimal** | | [optional] **ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] **StringProp** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Order.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Order.md index ca5d8992a513..f7d6827ed5c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Order.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/Order.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] **Id** | **long** | | [optional] **PetId** | **long** | | [optional] **Quantity** | **int** | | [optional] **ShipDate** | **DateTime** | | [optional] **Status** | **string** | Order Status | [optional] -**Complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md index 5ff4cb1b73cc..8f148be840b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/RequiredClass.md @@ -15,17 +15,6 @@ Name | Type | Description | Notes **RequiredNotnullableStringProp** | **string** | | **RequiredNotnullableUuid** | **Guid** | | **RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] **RequiredNullableArrayOfString** | **List<string>** | | **RequiredNullableBooleanProp** | **bool** | | **RequiredNullableDateProp** | **DateTime** | | @@ -37,8 +26,19 @@ Name | Type | Description | Notes **RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | **RequiredNullableStringProp** | **string** | | **RequiredNullableUuid** | **Guid** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] **NotRequiredNullableDateProp** | **DateTime** | | [optional] **NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] **NotrequiredNullableArrayOfString** | **List<string>** | | [optional] **NotrequiredNullableBooleanProp** | **bool** | | [optional] **NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/User.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/User.md index 455f031674d5..b5700f1c75d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/User.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/docs/models/User.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] **Email** | **string** | | [optional] **FirstName** | **string** | | [optional] **Id** | **long** | | [optional] **LastName** | **string** | | [optional] **ObjectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] **Password** | **string** | | [optional] **Phone** | **string** | | [optional] **UserStatus** | **int** | User Status | [optional] **Username** | **string** | | [optional] -**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] -**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] -**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs index f6e2fb899672..d2fe509d91fc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -173,18 +173,18 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index 9de2ee269436..a3170798f776 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -32,6 +32,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// /// Initializes a new instance of the class. /// + /// anytype1 /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// mapOfMapProperty /// mapProperty @@ -39,10 +40,10 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesAnytype2 /// mapWithUndeclaredPropertiesAnytype3 /// mapWithUndeclaredPropertiesString - /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default) { + Anytype1Option = anytype1; EmptyMapOption = emptyMap; MapOfMapPropertyOption = mapOfMapProperty; MapPropertyOption = mapProperty; @@ -50,12 +51,24 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } + /// /// Used to track the state of EmptyMap /// @@ -148,19 +161,6 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new(value); } } - /// - /// Used to track the state of Anytype1 - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option Anytype1Option { get; private set; } - - /// - /// Gets or Sets Anytype1 - /// - [JsonPropertyName("anytype_1")] - public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new(value); } } - /// /// Gets or Sets additional properties /// @@ -175,6 +175,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); @@ -182,7 +183,6 @@ public override string ToString() sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); - sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -221,6 +221,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anytype1 = default; Option emptyMap = default; Option>> mapOfMapProperty = default; Option> mapProperty = default; @@ -228,7 +229,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader Option mapWithUndeclaredPropertiesAnytype2 = default; Option> mapWithUndeclaredPropertiesAnytype3 = default; Option> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -245,6 +245,10 @@ 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)); + break; case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -273,10 +277,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (utf8JsonReader.TokenType != JsonTokenType.Null) mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -304,7 +304,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); } /// @@ -352,6 +352,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); if (additionalPropertiesClass.EmptyMapOption.IsSet) { writer.WritePropertyName("empty_map"); @@ -387,14 +395,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); } - if (additionalPropertiesClass.Anytype1Option.IsSet) - if (additionalPropertiesClass.Anytype1Option.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs index b5561b513756..8de1a656de5d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Cat.cs @@ -33,10 +33,10 @@ public partial class Cat : Animal, IValidatableObject /// Initializes a new instance of the class. /// /// className - /// declawed /// color (default to "red") + /// declawed [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, Option color = default, Option declawed = default) : base(className, color) { DeclawedOption = declawed; OnCreated(); @@ -95,8 +95,8 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option className = default; - Option declawed = default; Option color = default; + Option declawed = default; while (utf8JsonReader.Read()) { @@ -116,13 +116,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "className": className = new Option(utf8JsonReader.GetString()); break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) declawed = new Option(utf8JsonReader.GetBoolean()); break; - case "color": - color = new Option(utf8JsonReader.GetString()); - break; default: break; } @@ -135,13 +135,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed.IsSet && declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value, declawed, color); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(className.Value, color, declawed); } /// @@ -176,11 +176,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp writer.WriteString("className", cat.ClassName); - if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); - if (cat.ColorOption.IsSet) writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs index e8727e9633b9..09d26fdb1fa4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Category.cs @@ -32,24 +32,18 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(Option id = default, string name = @"default-name") { - Name = name; IdOption = id; + Name = name; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Name - /// - [JsonPropertyName("name")] - public string Name { get; set; } - /// /// Used to track the state of Id /// @@ -63,6 +57,12 @@ public Category(string name = @"default-name", Option id = default) [JsonPropertyName("id")] public long? Id { get { return this. IdOption; } set { this.IdOption = new(value); } } + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + /// /// Gets or Sets additional properties /// @@ -77,8 +77,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -117,8 +117,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -135,13 +135,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; default: break; } @@ -151,13 +151,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (!name.IsSet) throw new ArgumentException("Property is required for class Category.", nameof(name)); - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value, id); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value); } /// @@ -187,10 +187,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); + + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs index eaa8adb03e81..f8355e7576f9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -33,16 +33,16 @@ public partial class Drawing : Dictionary, IValidatableObject /// Initializes a new instance of the class. /// /// mainShape - /// shapes /// nullableShape /// shapeOrNull + /// shapes [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option> shapes = default) : base() { MainShapeOption = mainShape; - ShapesOption = shapes; NullableShapeOption = nullableShape; ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; OnCreated(); } @@ -61,19 +61,6 @@ public Drawing(Option mainShape = default, Option> shapes = d [JsonPropertyName("mainShape")] public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new(value); } } - /// - /// Used to track the state of Shapes - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ShapesOption { get; private set; } - - /// - /// Gets or Sets Shapes - /// - [JsonPropertyName("shapes")] - public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } - /// /// Used to track the state of NullableShape /// @@ -100,6 +87,19 @@ public Drawing(Option mainShape = default, Option> shapes = d [JsonPropertyName("shapeOrNull")] public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new(value); } } + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new(value); } } + /// /// Gets or Sets additional properties /// @@ -116,9 +116,9 @@ public override string ToString() sb.Append("class Drawing {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); sb.Append(" MainShape: ").Append(MainShape).Append("\n"); - sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -168,9 +168,9 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option mainShape = default; - Option> shapes = default; Option nullableShape = default; Option shapeOrNull = default; + Option> shapes = default; while (utf8JsonReader.Read()) { @@ -191,10 +191,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -203,6 +199,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; default: break; } @@ -215,7 +215,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); } /// @@ -253,11 +253,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); } - if (drawing.ShapesOption.IsSet) - { - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { @@ -274,6 +269,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs index 5be59457227e..ce39b4cb9ad9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -37,22 +37,22 @@ public partial class EnumTest : IValidatableObject /// enumIntegerOnly /// enumNumber /// enumString + /// outerEnum /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue - /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) { EnumStringRequired = enumStringRequired; EnumIntegerOption = enumInteger; EnumIntegerOnlyOption = enumIntegerOnly; EnumNumberOption = enumNumber; EnumStringOption = enumString; + OuterEnumOption = outerEnum; OuterEnumDefaultValueOption = outerEnumDefaultValue; OuterEnumIntegerOption = outerEnumInteger; OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; - OuterEnumOption = outerEnum; OnCreated(); } @@ -600,6 +600,19 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("enum_string")] public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new(value); } } + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } + /// /// Used to track the state of OuterEnumDefaultValue /// @@ -639,19 +652,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("outerEnumIntegerDefaultValue")] public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new(value); } } - /// - /// Used to track the state of OuterEnum - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option OuterEnumOption { get; private set; } - - /// - /// Gets or Sets OuterEnum - /// - [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -671,10 +671,10 @@ public override string ToString() sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -718,10 +718,10 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv Option enumIntegerOnly = default; Option enumNumber = default; Option enumString = default; + Option outerEnum = default; Option outerEnumDefaultValue = default; Option outerEnumInteger = default; Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -760,6 +760,11 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (enumStringRawValue != null) enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; + case "outerEnum": + string outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); if (outerEnumDefaultValueRawValue != null) @@ -775,11 +780,6 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValueRawValue != null) outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; - case "outerEnum": - string outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); - break; default: break; } @@ -813,7 +813,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); } /// @@ -861,6 +861,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string"); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); if (enumTest.OuterEnumDefaultValueOption.IsSet) { var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); @@ -876,14 +884,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) - if (enumTest.OuterEnumOption.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); - writer.WriteString("outerEnum", outerEnumRawValue); - } - else - writer.WriteNull("outerEnum"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs index 005ffef2791e..12a80a928810 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -32,9 +32,8 @@ public partial class NullableClass : Dictionary, IValidatableObj /// /// Initializes a new instance of the class. /// - /// arrayItemsNullable - /// objectItemsNullable /// arrayAndItemsNullableProp + /// arrayItemsNullable /// arrayNullableProp /// booleanProp /// dateProp @@ -42,14 +41,14 @@ public partial class NullableClass : Dictionary, IValidatableObj /// integerProp /// numberProp /// objectAndItemsNullableProp + /// objectItemsNullable /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(Option> arrayAndItemsNullableProp = default, Option> arrayItemsNullable = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectItemsNullable = default, Option> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullableOption = arrayItemsNullable; - ObjectItemsNullableOption = objectItemsNullable; ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; ArrayNullablePropOption = arrayNullableProp; BooleanPropOption = booleanProp; DatePropOption = dateProp; @@ -57,6 +56,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option> arrayItemsNullable = default, Option - /// Used to track the state of ArrayItemsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ArrayItemsNullableOption { get; private set; } - - /// - /// Gets or Sets ArrayItemsNullable - /// - [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectItemsNullable + /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ObjectItemsNullableOption { get; private set; } + public Option> ArrayAndItemsNullablePropOption { get; private set; } /// - /// Gets or Sets ObjectItemsNullable + /// Gets or Sets ArrayAndItemsNullableProp /// - [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + [JsonPropertyName("array_and_items_nullable_prop")] + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } /// - /// Used to track the state of ArrayAndItemsNullableProp + /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ArrayAndItemsNullablePropOption { get; private set; } + public Option> ArrayItemsNullableOption { get; private set; } /// - /// Gets or Sets ArrayAndItemsNullableProp + /// Gets or Sets ArrayItemsNullable /// - [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new(value); } } + [JsonPropertyName("array_items_nullable")] + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new(value); } } /// /// Used to track the state of ArrayNullableProp @@ -194,6 +181,19 @@ public NullableClass(Option> arrayItemsNullable = default, Option ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new(value); } } + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new(value); } } + /// /// Used to track the state of ObjectNullableProp /// @@ -235,9 +235,8 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class NullableClass {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); - sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); - sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); sb.Append(" DateProp: ").Append(DateProp).Append("\n"); @@ -245,6 +244,7 @@ public override string ToString() sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); sb.Append(" StringProp: ").Append(StringProp).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -305,9 +305,8 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayItemsNullable = default; - Option> objectItemsNullable = default; Option> arrayAndItemsNullableProp = default; + Option> arrayItemsNullable = default; Option> arrayNullableProp = default; Option booleanProp = default; Option dateProp = default; @@ -315,6 +314,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option integerProp = default; Option numberProp = default; Option> objectAndItemsNullableProp = default; + Option> objectItemsNullable = default; Option> objectNullableProp = default; Option stringProp = default; @@ -333,18 +333,14 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { - case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = 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)); - break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)); + break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -373,6 +369,10 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)); + break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -392,7 +392,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); } /// @@ -425,16 +425,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) - { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - } - if (nullableClass.ObjectItemsNullableOption.IsSet) - { - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { @@ -443,6 +433,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { @@ -489,6 +484,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs index 280ecf8785e1..57515c27c5e3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/Order.cs @@ -32,21 +32,21 @@ public partial class Order : IValidatableObject /// /// Initializes a new instance of the class. /// + /// complete (default to false) /// id /// petId /// quantity /// shipDate /// Order Status - /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) { + CompleteOption = complete; IdOption = id; PetIdOption = petId; QuantityOption = quantity; ShipDateOption = shipDate; StatusOption = status; - CompleteOption = complete; OnCreated(); } @@ -147,6 +147,19 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("status")] public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new(value); } } + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } + /// /// Used to track the state of Id /// @@ -200,19 +213,6 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("shipDate")] public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new(value); } } - /// - /// Used to track the state of Complete - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option CompleteOption { get; private set; } - - /// - /// Gets or Sets Complete - /// - [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -227,12 +227,12 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" PetId: ").Append(PetId).Append("\n"); sb.Append(" Quantity: ").Append(Quantity).Append("\n"); sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -276,12 +276,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option complete = default; Option id = default; Option petId = default; Option quantity = default; Option shipDate = default; Option status = default; - Option complete = default; while (utf8JsonReader.Read()) { @@ -298,6 +298,10 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); @@ -319,16 +323,15 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (statusRawValue != null) status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; - case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); - break; default: break; } } } + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); @@ -344,10 +347,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete.IsSet && complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - - return new Order(id, petId, quantity, shipDate, status, complete); + return new Order(complete, id, petId, quantity, shipDate, status); } /// @@ -374,6 +374,9 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); + if (order.IdOption.IsSet) writer.WriteNumber("id", order.IdOption.Value.Value); @@ -391,9 +394,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializ writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - - if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 7f3725be0373..a7a41e724c5e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -43,17 +43,6 @@ public partial class RequiredClass : IValidatableObject /// requiredNotnullableStringProp /// requiredNotnullableUuid /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid /// requiredNullableArrayOfString /// requiredNullableBooleanProp /// requiredNullableDateProp @@ -65,8 +54,19 @@ public partial class RequiredClass : IValidatableObject /// requiredNullableOuterEnumDefaultValue /// requiredNullableStringProp /// requiredNullableUuid + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp /// notRequiredNullableDateProp /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid /// notrequiredNullableArrayOfString /// notrequiredNullableBooleanProp /// notrequiredNullableDatetimeProp @@ -77,7 +77,7 @@ public partial class RequiredClass : IValidatableObject /// notrequiredNullableStringProp /// notrequiredNullableUuid [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) { RequiredNotNullableDateProp = requiredNotNullableDateProp; RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; @@ -90,17 +90,6 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNotnullableStringProp = requiredNotnullableStringProp; RequiredNotnullableUuid = requiredNotnullableUuid; RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; RequiredNullableArrayOfString = requiredNullableArrayOfString; RequiredNullableBooleanProp = requiredNullableBooleanProp; RequiredNullableDateProp = requiredNullableDateProp; @@ -112,8 +101,19 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; RequiredNullableStringProp = requiredNullableStringProp; RequiredNullableUuid = requiredNullableUuid; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; NotRequiredNullableDatePropOption = notRequiredNullableDateProp; NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; @@ -421,9 +421,9 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// - /// Defines NotrequiredNotnullableEnumInteger + /// Defines RequiredNullableEnumInteger /// - public enum NotrequiredNotnullableEnumIntegerEnum + public enum RequiredNullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -437,65 +437,58 @@ public enum NotrequiredNotnullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumInteger - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger + /// Gets or Sets RequiredNullableEnumInteger /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// - /// Defines NotrequiredNotnullableEnumIntegerOnly + /// Defines RequiredNullableEnumIntegerOnly /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum + public enum RequiredNullableEnumIntegerOnlyEnum { /// /// Enum NUMBER_2 for value: 2 @@ -509,65 +502,58 @@ public enum NotrequiredNotnullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// Gets or Sets RequiredNullableEnumIntegerOnly /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// - /// Defines NotrequiredNotnullableEnumString + /// Defines RequiredNullableEnumString /// - public enum NotrequiredNotnullableEnumStringEnum + public enum RequiredNullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -611,139 +597,128 @@ public enum NotrequiredNotnullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) return "UPPER"; - if (value == NotrequiredNotnullableEnumStringEnum.Lower) + if (value == RequiredNullableEnumStringEnum.Lower) return "lower"; - if (value == NotrequiredNotnullableEnumStringEnum.Empty) + if (value == RequiredNullableEnumStringEnum.Empty) return ""; - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + if (value == RequiredNullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Used to track the state of NotrequiredNotnullableEnumString - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } - - /// - /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableEnumString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// - /// Defines RequiredNullableEnumInteger + /// Defines NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerEnum + public enum NotrequiredNotnullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -757,61 +732,68 @@ public enum RequiredNullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumInteger + /// Used to track the state of NotrequiredNotnullableEnumInteger /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// - /// Defines RequiredNullableEnumIntegerOnly + /// Gets or Sets NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 /// NUMBER_2 = 2, @@ -822,58 +804,65 @@ public enum RequiredNullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumIntegerOnly + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// - /// Defines RequiredNullableEnumString + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// - public enum RequiredNullableEnumStringEnum + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -917,123 +906,134 @@ public enum RequiredNullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) return "UPPER"; - if (value == RequiredNullableEnumStringEnum.Lower) + if (value == NotrequiredNotnullableEnumStringEnum.Lower) return "lower"; - if (value == RequiredNullableEnumStringEnum.Empty) + if (value == NotrequiredNotnullableEnumStringEnum.Empty) return ""; - if (value == RequiredNullableEnumStringEnum.ValuewithTab) + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Gets or Sets RequiredNullableEnumString + /// Used to track the state of NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// Gets or Sets NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new(value); } } /// /// Defines NotrequiredNullableEnumInteger @@ -1402,165 +1402,165 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul public int RequiredNotnullableintegerProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableArrayOfString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableDatePropOption { get; private set; } + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } /// - /// Gets or Sets NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableBooleanProp /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDateProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } /// - /// Gets or Sets NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDatetimeProp /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableIntegerProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } /// - /// Gets or Sets NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableStringProp /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableBooleanProp + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableBooleanProp + /// Gets or Sets NotRequiredNotnullableDateProp /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// Gets or Sets NotRequiredNotnullableintegerProp /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableStringProp + /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableStringPropOption { get; private set; } + public Option NotRequiredNullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableStringProp + /// Gets or Sets NotRequiredNullableDateProp /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } /// - /// Used to track the state of NotrequiredNotnullableUuid + /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableUuidOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableArrayOfString + /// Gets or Sets NotRequiredNullableIntegerProp /// - [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableBooleanProp + /// Used to track the state of NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new(value); } } /// - /// Gets or Sets RequiredNullableDatetimeProp + /// Used to track the state of NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new(value); } } /// - /// Gets or Sets RequiredNullableStringProp + /// Used to track the state of NotrequiredNotnullableDatetimeProp /// - [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// - /// Gets or Sets RequiredNullableUuid + /// Gets or Sets NotrequiredNotnullableDatetimeProp /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableDateProp + /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableDatePropOption { get; private set; } + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableStringProp /// - [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new(value); } } + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new(value); } } /// - /// Used to track the state of NotRequiredNullableIntegerProp + /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableIntegerPropOption { get; private set; } + public Option NotrequiredNotnullableUuidOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableUuid /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new(value); } } + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString @@ -1653,17 +1653,6 @@ public override string ToString() sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); @@ -1675,8 +1664,19 @@ public override string ToString() sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); @@ -1717,16 +1717,6 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// /// The format to use to serialize RequiredNullableDateProp /// @@ -1737,11 +1727,21 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// /// The format to use to serialize NotRequiredNullableDateProp /// public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// /// The format to use to serialize NotrequiredNullableDatetimeProp /// @@ -1775,17 +1775,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNotnullableStringProp = default; Option requiredNotnullableUuid = default; Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; Option> requiredNullableArrayOfString = default; Option requiredNullableBooleanProp = default; Option requiredNullableDateProp = default; @@ -1797,8 +1786,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNullableOuterEnumDefaultValue = default; Option requiredNullableStringProp = default; Option requiredNullableUuid = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; Option notRequiredNullableDateProp = default; Option notRequiredNullableIntegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; Option> notrequiredNullableArrayOfString = default; Option notrequiredNullableBooleanProp = default; Option notrequiredNullableDatetimeProp = default; @@ -1869,51 +1869,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; case "required_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -1959,6 +1914,14 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; case "not_required_nullable_date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -1967,6 +1930,43 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; case "notrequired_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -2142,7 +2142,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2208,46 +2208,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); - - if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); - - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) - { - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - } - if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); - - if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); - - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); - - if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); - if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); @@ -2312,6 +2272,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); @@ -2324,6 +2290,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs index e4bd370798b3..b0991a50e48d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-net6.0/src/Org.OpenAPITools/Model/User.cs @@ -32,38 +32,66 @@ public partial class User : IValidatableObject /// /// Initializes a new instance of the class. /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// email /// firstName /// id /// lastName /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// password /// phone /// User Status /// username - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; EmailOption = email; FirstNameOption = firstName; IdOption = id; LastNameOption = lastName; ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; PasswordOption = password; PhoneOption = phone; UserStatusOption = userStatus; UsernameOption = username; - AnyTypePropOption = anyTypeProp; - AnyTypePropNullableOption = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + [JsonPropertyName("anyTypeProp")] + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + [JsonPropertyName("anyTypePropNullable")] + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } + /// /// Used to track the state of Email /// @@ -130,6 +158,20 @@ public User(Option email = default, Option firstName = default, [JsonPropertyName("objectWithNoDeclaredProps")] public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new(value); } } + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } + /// /// Used to track the state of Password /// @@ -183,48 +225,6 @@ public User(Option email = default, Option firstName = default, [JsonPropertyName("username")] public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new(value); } } - /// - /// Used to track the state of AnyTypeProp - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new(value); } } - - /// - /// Used to track the state of AnyTypePropNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropNullableOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new(value); } } - - /// - /// Used to track the state of ObjectWithNoDeclaredPropsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } - - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new(value); } } - /// /// Gets or Sets additional properties /// @@ -239,18 +239,18 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" FirstName: ").Append(FirstName).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" LastName: ").Append(LastName).Append("\n"); sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); - sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); - sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -289,18 +289,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anyTypeProp = default; + Option anyTypePropNullable = default; Option email = default; Option firstName = default; Option id = default; Option lastName = default; Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; Option password = default; Option phone = default; Option userStatus = default; Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -317,6 +317,14 @@ 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)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "email": email = new Option(utf8JsonReader.GetString()); break; @@ -334,6 +342,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (utf8JsonReader.TokenType != JsonTokenType.Null) objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "password": password = new Option(utf8JsonReader.GetString()); break; @@ -347,18 +359,6 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "username": username = new Option(utf8JsonReader.GetString()); break; - case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -392,7 +392,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); } /// @@ -440,6 +440,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet && user.Username == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); if (user.EmailOption.IsSet) writer.WriteString("email", user.Email); @@ -457,6 +473,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); @@ -468,31 +492,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet) writer.WriteString("username", user.Username); - - if (user.AnyTypePropOption.IsSet) - if (user.AnyTypePropOption.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) - if (user.AnyTypePropNullableOption.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) - if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/AdditionalPropertiesClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/AdditionalPropertiesClass.md index f79869f95a71..2bbe882fcfcc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/AdditionalPropertiesClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/AdditionalPropertiesClass.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Anytype1** | **Object** | | [optional] **EmptyMap** | **Object** | an object with no declared properties and no undeclared properties, hence it's an empty map. | [optional] **MapOfMapProperty** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapProperty** | **Dictionary<string, string>** | | [optional] @@ -11,7 +12,6 @@ Name | Type | Description | Notes **MapWithUndeclaredPropertiesAnytype2** | **Object** | | [optional] **MapWithUndeclaredPropertiesAnytype3** | **Dictionary<string, Object>** | | [optional] **MapWithUndeclaredPropertiesString** | **Dictionary<string, string>** | | [optional] -**Anytype1** | **Object** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md index c2cf3f8e919e..6eb0a2e13eaa 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Category.md @@ -4,8 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Name** | **string** | | [default to "default-name"] **Id** | **long** | | [optional] +**Name** | **string** | | [default to "default-name"] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Drawing.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Drawing.md index 215793515f64..95f49b2ed600 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Drawing.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Drawing.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MainShape** | [**Shape**](Shape.md) | | [optional] -**Shapes** | [**List<Shape>**](Shape.md) | | [optional] **NullableShape** | [**NullableShape**](NullableShape.md) | | [optional] **ShapeOrNull** | [**ShapeOrNull**](ShapeOrNull.md) | | [optional] +**Shapes** | [**List<Shape>**](Shape.md) | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md index 470701a32abc..ebd7ccf2c864 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/EnumTest.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **EnumIntegerOnly** | **int** | | [optional] **EnumNumber** | **double** | | [optional] **EnumString** | **string** | | [optional] +**OuterEnum** | **OuterEnum** | | [optional] **OuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] **OuterEnumInteger** | **OuterEnumInteger** | | [optional] **OuterEnumIntegerDefaultValue** | **OuterEnumIntegerDefaultValue** | | [optional] -**OuterEnum** | **OuterEnum** | | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/NullableClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/NullableClass.md index 394feef77dbb..5d9965f55c0a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/NullableClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/NullableClass.md @@ -4,9 +4,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**ArrayItemsNullable** | **List<Object>** | | [optional] -**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ArrayAndItemsNullableProp** | **List<Object>** | | [optional] +**ArrayItemsNullable** | **List<Object>** | | [optional] **ArrayNullableProp** | **List<Object>** | | [optional] **BooleanProp** | **bool** | | [optional] **DateProp** | **DateTime** | | [optional] @@ -14,6 +13,7 @@ Name | Type | Description | Notes **IntegerProp** | **int** | | [optional] **NumberProp** | **decimal** | | [optional] **ObjectAndItemsNullableProp** | **Dictionary<string, Object>** | | [optional] +**ObjectItemsNullable** | **Dictionary<string, Object>** | | [optional] **ObjectNullableProp** | **Dictionary<string, Object>** | | [optional] **StringProp** | **string** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Order.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Order.md index ca5d8992a513..f7d6827ed5c9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Order.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/Order.md @@ -4,12 +4,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Complete** | **bool** | | [optional] [default to false] **Id** | **long** | | [optional] **PetId** | **long** | | [optional] **Quantity** | **int** | | [optional] **ShipDate** | **DateTime** | | [optional] **Status** | **string** | Order Status | [optional] -**Complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md index 5ff4cb1b73cc..8f148be840b0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/RequiredClass.md @@ -15,17 +15,6 @@ Name | Type | Description | Notes **RequiredNotnullableStringProp** | **string** | | **RequiredNotnullableUuid** | **Guid** | | **RequiredNotnullableintegerProp** | **int** | | -**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] -**NotRequiredNotnullableintegerProp** | **int** | | [optional] -**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] -**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] -**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] -**NotrequiredNotnullableEnumInteger** | **int** | | [optional] -**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] -**NotrequiredNotnullableEnumString** | **string** | | [optional] -**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] -**NotrequiredNotnullableStringProp** | **string** | | [optional] -**NotrequiredNotnullableUuid** | **Guid** | | [optional] **RequiredNullableArrayOfString** | **List<string>** | | **RequiredNullableBooleanProp** | **bool** | | **RequiredNullableDateProp** | **DateTime** | | @@ -37,8 +26,19 @@ Name | Type | Description | Notes **RequiredNullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | **RequiredNullableStringProp** | **string** | | **RequiredNullableUuid** | **Guid** | | +**NotRequiredNotnullableDateProp** | **DateTime** | | [optional] +**NotRequiredNotnullableintegerProp** | **int** | | [optional] **NotRequiredNullableDateProp** | **DateTime** | | [optional] **NotRequiredNullableIntegerProp** | **int** | | [optional] +**NotrequiredNotnullableArrayOfString** | **List<string>** | | [optional] +**NotrequiredNotnullableBooleanProp** | **bool** | | [optional] +**NotrequiredNotnullableDatetimeProp** | **DateTime** | | [optional] +**NotrequiredNotnullableEnumInteger** | **int** | | [optional] +**NotrequiredNotnullableEnumIntegerOnly** | **int** | | [optional] +**NotrequiredNotnullableEnumString** | **string** | | [optional] +**NotrequiredNotnullableOuterEnumDefaultValue** | **OuterEnumDefaultValue** | | [optional] +**NotrequiredNotnullableStringProp** | **string** | | [optional] +**NotrequiredNotnullableUuid** | **Guid** | | [optional] **NotrequiredNullableArrayOfString** | **List<string>** | | [optional] **NotrequiredNullableBooleanProp** | **bool** | | [optional] **NotrequiredNullableDatetimeProp** | **DateTime** | | [optional] diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/User.md b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/User.md index 455f031674d5..b5700f1c75d9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/User.md +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/docs/models/User.md @@ -4,18 +4,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] +**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] **Email** | **string** | | [optional] **FirstName** | **string** | | [optional] **Id** | **long** | | [optional] **LastName** | **string** | | [optional] **ObjectWithNoDeclaredProps** | **Object** | test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. | [optional] +**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] **Password** | **string** | | [optional] **Phone** | **string** | | [optional] **UserStatus** | **int** | User Status | [optional] **Username** | **string** | | [optional] -**AnyTypeProp** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 | [optional] -**AnyTypePropNullable** | **Object** | test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. | [optional] -**ObjectWithNoDeclaredPropsNullable** | **Object** | test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. | [optional] [[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs index 7982f6cfc930..99e27fdfa167 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Client/ClientUtils.cs @@ -173,18 +173,18 @@ public static string ParameterToString(object obj, string format = ISO8601_DATET return RequiredClass.RequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNotnullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNotnullableEnumStringEnum requiredClassRequiredNotnullableEnumStringEnum) return RequiredClass.RequiredNotnullableEnumStringEnumToJsonValue(requiredClassRequiredNotnullableEnumStringEnum); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) - return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); - if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) - return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.RequiredNullableEnumIntegerEnum requiredClassRequiredNullableEnumIntegerEnum) return RequiredClass.RequiredNullableEnumIntegerEnumToJsonValue(requiredClassRequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumIntegerOnlyEnum requiredClassRequiredNullableEnumIntegerOnlyEnum) return RequiredClass.RequiredNullableEnumIntegerOnlyEnumToJsonValue(requiredClassRequiredNullableEnumIntegerOnlyEnum).ToString(); if (obj is RequiredClass.RequiredNullableEnumStringEnum requiredClassRequiredNullableEnumStringEnum) return RequiredClass.RequiredNullableEnumStringEnumToJsonValue(requiredClassRequiredNullableEnumStringEnum); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerEnum requiredClassNotrequiredNotnullableEnumIntegerEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum) + return RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClassNotrequiredNotnullableEnumIntegerOnlyEnum).ToString(); + if (obj is RequiredClass.NotrequiredNotnullableEnumStringEnum requiredClassNotrequiredNotnullableEnumStringEnum) + return RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClassNotrequiredNotnullableEnumStringEnum); if (obj is RequiredClass.NotrequiredNullableEnumIntegerEnum requiredClassNotrequiredNullableEnumIntegerEnum) return RequiredClass.NotrequiredNullableEnumIntegerEnumToJsonValue(requiredClassNotrequiredNullableEnumIntegerEnum).ToString(); if (obj is RequiredClass.NotrequiredNullableEnumIntegerOnlyEnum requiredClassNotrequiredNullableEnumIntegerOnlyEnum) diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs index dfd7ec688162..e723f090a2d5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/AdditionalPropertiesClass.cs @@ -32,6 +32,7 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// /// Initializes a new instance of the class. /// + /// anytype1 /// an object with no declared properties and no undeclared properties, hence it's an empty map. /// mapOfMapProperty /// mapProperty @@ -39,10 +40,10 @@ public partial class AdditionalPropertiesClass : IValidatableObject /// mapWithUndeclaredPropertiesAnytype2 /// mapWithUndeclaredPropertiesAnytype3 /// mapWithUndeclaredPropertiesString - /// anytype1 [JsonConstructor] - public AdditionalPropertiesClass(Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default, Option anytype1 = default) + public AdditionalPropertiesClass(Option anytype1 = default, Option emptyMap = default, Option>> mapOfMapProperty = default, Option> mapProperty = default, Option mapWithUndeclaredPropertiesAnytype1 = default, Option mapWithUndeclaredPropertiesAnytype2 = default, Option> mapWithUndeclaredPropertiesAnytype3 = default, Option> mapWithUndeclaredPropertiesString = default) { + Anytype1Option = anytype1; EmptyMapOption = emptyMap; MapOfMapPropertyOption = mapOfMapProperty; MapPropertyOption = mapProperty; @@ -50,12 +51,24 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option + /// Used to track the state of Anytype1 + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option Anytype1Option { get; private set; } + + /// + /// Gets or Sets Anytype1 + /// + [JsonPropertyName("anytype_1")] + public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new Option(value); } } + /// /// Used to track the state of EmptyMap /// @@ -148,19 +161,6 @@ public AdditionalPropertiesClass(Option emptyMap = default, Option MapWithUndeclaredPropertiesString { get { return this. MapWithUndeclaredPropertiesStringOption; } set { this.MapWithUndeclaredPropertiesStringOption = new Option>(value); } } - /// - /// Used to track the state of Anytype1 - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option Anytype1Option { get; private set; } - - /// - /// Gets or Sets Anytype1 - /// - [JsonPropertyName("anytype_1")] - public Object Anytype1 { get { return this. Anytype1Option; } set { this.Anytype1Option = new Option(value); } } - /// /// Gets or Sets additional properties /// @@ -175,6 +175,7 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class AdditionalPropertiesClass {\n"); + sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" EmptyMap: ").Append(EmptyMap).Append("\n"); sb.Append(" MapOfMapProperty: ").Append(MapOfMapProperty).Append("\n"); sb.Append(" MapProperty: ").Append(MapProperty).Append("\n"); @@ -182,7 +183,6 @@ public override string ToString() sb.Append(" MapWithUndeclaredPropertiesAnytype2: ").Append(MapWithUndeclaredPropertiesAnytype2).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesAnytype3: ").Append(MapWithUndeclaredPropertiesAnytype3).Append("\n"); sb.Append(" MapWithUndeclaredPropertiesString: ").Append(MapWithUndeclaredPropertiesString).Append("\n"); - sb.Append(" Anytype1: ").Append(Anytype1).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -221,6 +221,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anytype1 = default; Option emptyMap = default; Option>> mapOfMapProperty = default; Option> mapProperty = default; @@ -228,7 +229,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader Option mapWithUndeclaredPropertiesAnytype2 = default; Option> mapWithUndeclaredPropertiesAnytype3 = default; Option> mapWithUndeclaredPropertiesString = default; - Option anytype1 = default; while (utf8JsonReader.Read()) { @@ -245,6 +245,10 @@ 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)); + break; case "empty_map": if (utf8JsonReader.TokenType != JsonTokenType.Null) emptyMap = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -273,10 +277,6 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (utf8JsonReader.TokenType != JsonTokenType.Null) mapWithUndeclaredPropertiesString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); break; - case "anytype_1": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anytype1 = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -304,7 +304,7 @@ public override AdditionalPropertiesClass Read(ref Utf8JsonReader utf8JsonReader if (mapWithUndeclaredPropertiesString.IsSet && mapWithUndeclaredPropertiesString.Value == null) throw new ArgumentNullException(nameof(mapWithUndeclaredPropertiesString), "Property is not nullable for class AdditionalPropertiesClass."); - return new AdditionalPropertiesClass(emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString, anytype1); + return new AdditionalPropertiesClass(anytype1, emptyMap, mapOfMapProperty, mapProperty, mapWithUndeclaredPropertiesAnytype1, mapWithUndeclaredPropertiesAnytype2, mapWithUndeclaredPropertiesAnytype3, mapWithUndeclaredPropertiesString); } /// @@ -352,6 +352,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass if (additionalPropertiesClass.MapWithUndeclaredPropertiesStringOption.IsSet && additionalPropertiesClass.MapWithUndeclaredPropertiesString == null) throw new ArgumentNullException(nameof(additionalPropertiesClass.MapWithUndeclaredPropertiesString), "Property is required for class AdditionalPropertiesClass."); + if (additionalPropertiesClass.Anytype1Option.IsSet) + if (additionalPropertiesClass.Anytype1Option.Value != null) + { + writer.WritePropertyName("anytype_1"); + JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); + } + else + writer.WriteNull("anytype_1"); if (additionalPropertiesClass.EmptyMapOption.IsSet) { writer.WritePropertyName("empty_map"); @@ -387,14 +395,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, AdditionalPropertiesClass writer.WritePropertyName("map_with_undeclared_properties_string"); JsonSerializer.Serialize(writer, additionalPropertiesClass.MapWithUndeclaredPropertiesString, jsonSerializerOptions); } - if (additionalPropertiesClass.Anytype1Option.IsSet) - if (additionalPropertiesClass.Anytype1Option.Value != null) - { - writer.WritePropertyName("anytype_1"); - JsonSerializer.Serialize(writer, additionalPropertiesClass.Anytype1, jsonSerializerOptions); - } - else - writer.WriteNull("anytype_1"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs index ebb60c07c02c..d032e72761dd 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Cat.cs @@ -33,10 +33,10 @@ public partial class Cat : Animal, IValidatableObject /// Initializes a new instance of the class. /// /// className - /// declawed /// color (default to "red") + /// declawed [JsonConstructor] - public Cat(string className, Option declawed = default, Option color = default) : base(className, color) + public Cat(string className, Option color = default, Option declawed = default) : base(className, color) { DeclawedOption = declawed; OnCreated(); @@ -95,8 +95,8 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option className = default; - Option declawed = default; Option color = default; + Option declawed = default; while (utf8JsonReader.Read()) { @@ -116,13 +116,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "className": className = new Option(utf8JsonReader.GetString()); break; + case "color": + color = new Option(utf8JsonReader.GetString()); + break; case "declawed": if (utf8JsonReader.TokenType != JsonTokenType.Null) declawed = new Option(utf8JsonReader.GetBoolean()); break; - case "color": - color = new Option(utf8JsonReader.GetString()); - break; default: break; } @@ -135,13 +135,13 @@ public override Cat Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (className.IsSet && className.Value == null) throw new ArgumentNullException(nameof(className), "Property is not nullable for class Cat."); - if (declawed.IsSet && declawed.Value == null) - throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); - if (color.IsSet && color.Value == null) throw new ArgumentNullException(nameof(color), "Property is not nullable for class Cat."); - return new Cat(className.Value, declawed, color); + if (declawed.IsSet && declawed.Value == null) + throw new ArgumentNullException(nameof(declawed), "Property is not nullable for class Cat."); + + return new Cat(className.Value, color, declawed); } /// @@ -176,11 +176,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Cat cat, JsonSerializerOp writer.WriteString("className", cat.ClassName); - if (cat.DeclawedOption.IsSet) - writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); - if (cat.ColorOption.IsSet) writer.WriteString("color", cat.Color); + + if (cat.DeclawedOption.IsSet) + writer.WriteBoolean("declawed", cat.DeclawedOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs index 9e7d1939c1e8..315dd17bd315 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Category.cs @@ -32,24 +32,18 @@ public partial class Category : IValidatableObject /// /// Initializes a new instance of the class. /// - /// name (default to "default-name") /// id + /// name (default to "default-name") [JsonConstructor] - public Category(string name = @"default-name", Option id = default) + public Category(Option id = default, string name = @"default-name") { - Name = name; IdOption = id; + Name = name; OnCreated(); } partial void OnCreated(); - /// - /// Gets or Sets Name - /// - [JsonPropertyName("name")] - public string Name { get; set; } - /// /// Used to track the state of Id /// @@ -63,6 +57,12 @@ public Category(string name = @"default-name", Option id = default) [JsonPropertyName("id")] public long? Id { get { return this. IdOption; } set { this.IdOption = new Option(value); } } + /// + /// Gets or Sets Name + /// + [JsonPropertyName("name")] + public string Name { get; set; } + /// /// Gets or Sets additional properties /// @@ -77,8 +77,8 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -117,8 +117,8 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option name = default; Option id = default; + Option name = default; while (utf8JsonReader.Read()) { @@ -135,13 +135,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv switch (localVarJsonPropertyName) { - case "name": - name = new Option(utf8JsonReader.GetString()); - break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); break; + case "name": + name = new Option(utf8JsonReader.GetString()); + break; default: break; } @@ -151,13 +151,13 @@ public override Category Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (!name.IsSet) throw new ArgumentException("Property is required for class Category.", nameof(name)); - if (name.IsSet && name.Value == null) - throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); - if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Category."); - return new Category(name.Value, id); + if (name.IsSet && name.Value == null) + throw new ArgumentNullException(nameof(name), "Property is not nullable for class Category."); + + return new Category(id, name.Value); } /// @@ -187,10 +187,10 @@ public void WriteProperties(ref Utf8JsonWriter writer, Category category, JsonSe if (category.Name == null) throw new ArgumentNullException(nameof(category.Name), "Property is required for class Category."); - writer.WriteString("name", category.Name); - if (category.IdOption.IsSet) writer.WriteNumber("id", category.IdOption.Value.Value); + + writer.WriteString("name", category.Name); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs index 509e00060834..63a985af8fc3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Drawing.cs @@ -33,16 +33,16 @@ public partial class Drawing : Dictionary, IValidatableObject /// Initializes a new instance of the class. /// /// mainShape - /// shapes /// nullableShape /// shapeOrNull + /// shapes [JsonConstructor] - public Drawing(Option mainShape = default, Option> shapes = default, Option nullableShape = default, Option shapeOrNull = default) : base() + public Drawing(Option mainShape = default, Option nullableShape = default, Option shapeOrNull = default, Option> shapes = default) : base() { MainShapeOption = mainShape; - ShapesOption = shapes; NullableShapeOption = nullableShape; ShapeOrNullOption = shapeOrNull; + ShapesOption = shapes; OnCreated(); } @@ -61,19 +61,6 @@ public Drawing(Option mainShape = default, Option> shapes = d [JsonPropertyName("mainShape")] public Shape MainShape { get { return this. MainShapeOption; } set { this.MainShapeOption = new Option(value); } } - /// - /// Used to track the state of Shapes - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ShapesOption { get; private set; } - - /// - /// Gets or Sets Shapes - /// - [JsonPropertyName("shapes")] - public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new Option>(value); } } - /// /// Used to track the state of NullableShape /// @@ -100,6 +87,19 @@ public Drawing(Option mainShape = default, Option> shapes = d [JsonPropertyName("shapeOrNull")] public ShapeOrNull ShapeOrNull { get { return this. ShapeOrNullOption; } set { this.ShapeOrNullOption = new Option(value); } } + /// + /// Used to track the state of Shapes + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> ShapesOption { get; private set; } + + /// + /// Gets or Sets Shapes + /// + [JsonPropertyName("shapes")] + public List Shapes { get { return this. ShapesOption; } set { this.ShapesOption = new Option>(value); } } + /// /// Gets or Sets additional properties /// @@ -116,9 +116,9 @@ public override string ToString() sb.Append("class Drawing {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); sb.Append(" MainShape: ").Append(MainShape).Append("\n"); - sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" NullableShape: ").Append(NullableShape).Append("\n"); sb.Append(" ShapeOrNull: ").Append(ShapeOrNull).Append("\n"); + sb.Append(" Shapes: ").Append(Shapes).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -168,9 +168,9 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve JsonTokenType startingTokenType = utf8JsonReader.TokenType; Option mainShape = default; - Option> shapes = default; Option nullableShape = default; Option shapeOrNull = default; + Option> shapes = default; while (utf8JsonReader.Read()) { @@ -191,10 +191,6 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) mainShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; - case "shapes": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; case "nullableShape": if (utf8JsonReader.TokenType != JsonTokenType.Null) nullableShape = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -203,6 +199,10 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (utf8JsonReader.TokenType != JsonTokenType.Null) shapeOrNull = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "shapes": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + shapes = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; default: break; } @@ -215,7 +215,7 @@ public override Drawing Read(ref Utf8JsonReader utf8JsonReader, Type typeToConve if (shapes.IsSet && shapes.Value == null) throw new ArgumentNullException(nameof(shapes), "Property is not nullable for class Drawing."); - return new Drawing(mainShape, shapes, nullableShape, shapeOrNull); + return new Drawing(mainShape, nullableShape, shapeOrNull, shapes); } /// @@ -253,11 +253,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri writer.WritePropertyName("mainShape"); JsonSerializer.Serialize(writer, drawing.MainShape, jsonSerializerOptions); } - if (drawing.ShapesOption.IsSet) - { - writer.WritePropertyName("shapes"); - JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); - } if (drawing.NullableShapeOption.IsSet) if (drawing.NullableShapeOption.Value != null) { @@ -274,6 +269,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, Drawing drawing, JsonSeri } else writer.WriteNull("shapeOrNull"); + if (drawing.ShapesOption.IsSet) + { + writer.WritePropertyName("shapes"); + JsonSerializer.Serialize(writer, drawing.Shapes, jsonSerializerOptions); + } } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs index 3681bdf3e545..0a730df5230a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/EnumTest.cs @@ -37,22 +37,22 @@ public partial class EnumTest : IValidatableObject /// enumIntegerOnly /// enumNumber /// enumString + /// outerEnum /// outerEnumDefaultValue /// outerEnumInteger /// outerEnumIntegerDefaultValue - /// outerEnum [JsonConstructor] - public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default, Option outerEnum = default) + public EnumTest(EnumStringRequiredEnum enumStringRequired, Option enumInteger = default, Option enumIntegerOnly = default, Option enumNumber = default, Option enumString = default, Option outerEnum = default, Option outerEnumDefaultValue = default, Option outerEnumInteger = default, Option outerEnumIntegerDefaultValue = default) { EnumStringRequired = enumStringRequired; EnumIntegerOption = enumInteger; EnumIntegerOnlyOption = enumIntegerOnly; EnumNumberOption = enumNumber; EnumStringOption = enumString; + OuterEnumOption = outerEnum; OuterEnumDefaultValueOption = outerEnumDefaultValue; OuterEnumIntegerOption = outerEnumInteger; OuterEnumIntegerDefaultValueOption = outerEnumIntegerDefaultValue; - OuterEnumOption = outerEnum; OnCreated(); } @@ -600,6 +600,19 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("enum_string")] public EnumStringEnum? EnumString { get { return this.EnumStringOption; } set { this.EnumStringOption = new Option(value); } } + /// + /// Used to track the state of OuterEnum + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option OuterEnumOption { get; private set; } + + /// + /// Gets or Sets OuterEnum + /// + [JsonPropertyName("outerEnum")] + public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new Option(value); } } + /// /// Used to track the state of OuterEnumDefaultValue /// @@ -639,19 +652,6 @@ public static string EnumStringEnumToJsonValue(EnumStringEnum? value) [JsonPropertyName("outerEnumIntegerDefaultValue")] public OuterEnumIntegerDefaultValue? OuterEnumIntegerDefaultValue { get { return this.OuterEnumIntegerDefaultValueOption; } set { this.OuterEnumIntegerDefaultValueOption = new Option(value); } } - /// - /// Used to track the state of OuterEnum - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option OuterEnumOption { get; private set; } - - /// - /// Gets or Sets OuterEnum - /// - [JsonPropertyName("outerEnum")] - public OuterEnum? OuterEnum { get { return this.OuterEnumOption; } set { this.OuterEnumOption = new Option(value); } } - /// /// Gets or Sets additional properties /// @@ -671,10 +671,10 @@ public override string ToString() sb.Append(" EnumIntegerOnly: ").Append(EnumIntegerOnly).Append("\n"); sb.Append(" EnumNumber: ").Append(EnumNumber).Append("\n"); sb.Append(" EnumString: ").Append(EnumString).Append("\n"); + sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" OuterEnumDefaultValue: ").Append(OuterEnumDefaultValue).Append("\n"); sb.Append(" OuterEnumInteger: ").Append(OuterEnumInteger).Append("\n"); sb.Append(" OuterEnumIntegerDefaultValue: ").Append(OuterEnumIntegerDefaultValue).Append("\n"); - sb.Append(" OuterEnum: ").Append(OuterEnum).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -718,10 +718,10 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv Option enumIntegerOnly = default; Option enumNumber = default; Option enumString = default; + Option outerEnum = default; Option outerEnumDefaultValue = default; Option outerEnumInteger = default; Option outerEnumIntegerDefaultValue = default; - Option outerEnum = default; while (utf8JsonReader.Read()) { @@ -760,6 +760,11 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (enumStringRawValue != null) enumString = new Option(EnumTest.EnumStringEnumFromStringOrDefault(enumStringRawValue)); break; + case "outerEnum": + string outerEnumRawValue = utf8JsonReader.GetString(); + if (outerEnumRawValue != null) + outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); + break; case "outerEnumDefaultValue": string outerEnumDefaultValueRawValue = utf8JsonReader.GetString(); if (outerEnumDefaultValueRawValue != null) @@ -775,11 +780,6 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValueRawValue != null) outerEnumIntegerDefaultValue = new Option(OuterEnumIntegerDefaultValueValueConverter.FromStringOrDefault(outerEnumIntegerDefaultValueRawValue)); break; - case "outerEnum": - string outerEnumRawValue = utf8JsonReader.GetString(); - if (outerEnumRawValue != null) - outerEnum = new Option(OuterEnumValueConverter.FromStringOrDefault(outerEnumRawValue)); - break; default: break; } @@ -813,7 +813,7 @@ public override EnumTest Read(ref Utf8JsonReader utf8JsonReader, Type typeToConv if (outerEnumIntegerDefaultValue.IsSet && outerEnumIntegerDefaultValue.Value == null) throw new ArgumentNullException(nameof(outerEnumIntegerDefaultValue), "Property is not nullable for class EnumTest."); - return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue, outerEnum); + return new EnumTest(enumStringRequired.Value.Value, enumInteger, enumIntegerOnly, enumNumber, enumString, outerEnum, outerEnumDefaultValue, outerEnumInteger, outerEnumIntegerDefaultValue); } /// @@ -861,6 +861,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe else writer.WriteNull("enum_string"); + if (enumTest.OuterEnumOption.IsSet) + if (enumTest.OuterEnumOption.Value != null) + { + var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); + writer.WriteString("outerEnum", outerEnumRawValue); + } + else + writer.WriteNull("outerEnum"); if (enumTest.OuterEnumDefaultValueOption.IsSet) { var outerEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumDefaultValue.Value); @@ -876,14 +884,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, EnumTest enumTest, JsonSe var outerEnumIntegerDefaultValueRawValue = OuterEnumIntegerDefaultValueValueConverter.ToJsonValue(enumTest.OuterEnumIntegerDefaultValue.Value); writer.WriteNumber("outerEnumIntegerDefaultValue", outerEnumIntegerDefaultValueRawValue); } - if (enumTest.OuterEnumOption.IsSet) - if (enumTest.OuterEnumOption.Value != null) - { - var outerEnumRawValue = OuterEnumValueConverter.ToJsonValue(enumTest.OuterEnumOption.Value.Value); - writer.WriteString("outerEnum", outerEnumRawValue); - } - else - writer.WriteNull("outerEnum"); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs index db07e377b094..205ed5a2f20d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/NullableClass.cs @@ -32,9 +32,8 @@ public partial class NullableClass : Dictionary, IValidatableObj /// /// Initializes a new instance of the class. /// - /// arrayItemsNullable - /// objectItemsNullable /// arrayAndItemsNullableProp + /// arrayItemsNullable /// arrayNullableProp /// booleanProp /// dateProp @@ -42,14 +41,14 @@ public partial class NullableClass : Dictionary, IValidatableObj /// integerProp /// numberProp /// objectAndItemsNullableProp + /// objectItemsNullable /// objectNullableProp /// stringProp [JsonConstructor] - public NullableClass(Option> arrayItemsNullable = default, Option> objectItemsNullable = default, Option> arrayAndItemsNullableProp = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectNullableProp = default, Option stringProp = default) : base() + public NullableClass(Option> arrayAndItemsNullableProp = default, Option> arrayItemsNullable = default, Option> arrayNullableProp = default, Option booleanProp = default, Option dateProp = default, Option datetimeProp = default, Option integerProp = default, Option numberProp = default, Option> objectAndItemsNullableProp = default, Option> objectItemsNullable = default, Option> objectNullableProp = default, Option stringProp = default) : base() { - ArrayItemsNullableOption = arrayItemsNullable; - ObjectItemsNullableOption = objectItemsNullable; ArrayAndItemsNullablePropOption = arrayAndItemsNullableProp; + ArrayItemsNullableOption = arrayItemsNullable; ArrayNullablePropOption = arrayNullableProp; BooleanPropOption = booleanProp; DatePropOption = dateProp; @@ -57,6 +56,7 @@ public NullableClass(Option> arrayItemsNullable = default, Option> arrayItemsNullable = default, Option - /// Used to track the state of ArrayItemsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ArrayItemsNullableOption { get; private set; } - - /// - /// Gets or Sets ArrayItemsNullable - /// - [JsonPropertyName("array_items_nullable")] - public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new Option>(value); } } - - /// - /// Used to track the state of ObjectItemsNullable + /// Used to track the state of ArrayAndItemsNullableProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ObjectItemsNullableOption { get; private set; } + public Option> ArrayAndItemsNullablePropOption { get; private set; } /// - /// Gets or Sets ObjectItemsNullable + /// Gets or Sets ArrayAndItemsNullableProp /// - [JsonPropertyName("object_items_nullable")] - public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new Option>(value); } } + [JsonPropertyName("array_and_items_nullable_prop")] + public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new Option>(value); } } /// - /// Used to track the state of ArrayAndItemsNullableProp + /// Used to track the state of ArrayItemsNullable /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> ArrayAndItemsNullablePropOption { get; private set; } + public Option> ArrayItemsNullableOption { get; private set; } /// - /// Gets or Sets ArrayAndItemsNullableProp + /// Gets or Sets ArrayItemsNullable /// - [JsonPropertyName("array_and_items_nullable_prop")] - public List ArrayAndItemsNullableProp { get { return this. ArrayAndItemsNullablePropOption; } set { this.ArrayAndItemsNullablePropOption = new Option>(value); } } + [JsonPropertyName("array_items_nullable")] + public List ArrayItemsNullable { get { return this. ArrayItemsNullableOption; } set { this.ArrayItemsNullableOption = new Option>(value); } } /// /// Used to track the state of ArrayNullableProp @@ -194,6 +181,19 @@ public NullableClass(Option> arrayItemsNullable = default, Option ObjectAndItemsNullableProp { get { return this. ObjectAndItemsNullablePropOption; } set { this.ObjectAndItemsNullablePropOption = new Option>(value); } } + /// + /// Used to track the state of ObjectItemsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> ObjectItemsNullableOption { get; private set; } + + /// + /// Gets or Sets ObjectItemsNullable + /// + [JsonPropertyName("object_items_nullable")] + public Dictionary ObjectItemsNullable { get { return this. ObjectItemsNullableOption; } set { this.ObjectItemsNullableOption = new Option>(value); } } + /// /// Used to track the state of ObjectNullableProp /// @@ -235,9 +235,8 @@ public override string ToString() StringBuilder sb = new StringBuilder(); sb.Append("class NullableClass {\n"); sb.Append(" ").Append(base.ToString()?.Replace("\n", "\n ")).Append("\n"); - sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); - sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ArrayAndItemsNullableProp: ").Append(ArrayAndItemsNullableProp).Append("\n"); + sb.Append(" ArrayItemsNullable: ").Append(ArrayItemsNullable).Append("\n"); sb.Append(" ArrayNullableProp: ").Append(ArrayNullableProp).Append("\n"); sb.Append(" BooleanProp: ").Append(BooleanProp).Append("\n"); sb.Append(" DateProp: ").Append(DateProp).Append("\n"); @@ -245,6 +244,7 @@ public override string ToString() sb.Append(" IntegerProp: ").Append(IntegerProp).Append("\n"); sb.Append(" NumberProp: ").Append(NumberProp).Append("\n"); sb.Append(" ObjectAndItemsNullableProp: ").Append(ObjectAndItemsNullableProp).Append("\n"); + sb.Append(" ObjectItemsNullable: ").Append(ObjectItemsNullable).Append("\n"); sb.Append(" ObjectNullableProp: ").Append(ObjectNullableProp).Append("\n"); sb.Append(" StringProp: ").Append(StringProp).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); @@ -305,9 +305,8 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT JsonTokenType startingTokenType = utf8JsonReader.TokenType; - Option> arrayItemsNullable = default; - Option> objectItemsNullable = default; Option> arrayAndItemsNullableProp = default; + Option> arrayItemsNullable = default; Option> arrayNullableProp = default; Option booleanProp = default; Option dateProp = default; @@ -315,6 +314,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option integerProp = default; Option numberProp = default; Option> objectAndItemsNullableProp = default; + Option> objectItemsNullable = default; Option> objectNullableProp = default; Option stringProp = default; @@ -333,18 +333,14 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT switch (localVarJsonPropertyName) { - case "array_items_nullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - arrayItemsNullable = 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)); - break; case "array_and_items_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)); + break; case "array_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) arrayNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -373,6 +369,10 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) 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)); + break; case "object_nullable_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) objectNullableProp = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -392,7 +392,7 @@ public override NullableClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (objectItemsNullable.IsSet && objectItemsNullable.Value == null) throw new ArgumentNullException(nameof(objectItemsNullable), "Property is not nullable for class NullableClass."); - return new NullableClass(arrayItemsNullable, objectItemsNullable, arrayAndItemsNullableProp, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectNullableProp, stringProp); + return new NullableClass(arrayAndItemsNullableProp, arrayItemsNullable, arrayNullableProp, booleanProp, dateProp, datetimeProp, integerProp, numberProp, objectAndItemsNullableProp, objectItemsNullable, objectNullableProp, stringProp); } /// @@ -425,16 +425,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla if (nullableClass.ObjectItemsNullableOption.IsSet && nullableClass.ObjectItemsNullable == null) throw new ArgumentNullException(nameof(nullableClass.ObjectItemsNullable), "Property is required for class NullableClass."); - if (nullableClass.ArrayItemsNullableOption.IsSet) - { - writer.WritePropertyName("array_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); - } - if (nullableClass.ObjectItemsNullableOption.IsSet) - { - writer.WritePropertyName("object_items_nullable"); - JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); - } if (nullableClass.ArrayAndItemsNullablePropOption.IsSet) if (nullableClass.ArrayAndItemsNullablePropOption.Value != null) { @@ -443,6 +433,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("array_and_items_nullable_prop"); + if (nullableClass.ArrayItemsNullableOption.IsSet) + { + writer.WritePropertyName("array_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ArrayItemsNullable, jsonSerializerOptions); + } if (nullableClass.ArrayNullablePropOption.IsSet) if (nullableClass.ArrayNullablePropOption.Value != null) { @@ -489,6 +484,11 @@ public void WriteProperties(ref Utf8JsonWriter writer, NullableClass nullableCla } else writer.WriteNull("object_and_items_nullable_prop"); + if (nullableClass.ObjectItemsNullableOption.IsSet) + { + writer.WritePropertyName("object_items_nullable"); + JsonSerializer.Serialize(writer, nullableClass.ObjectItemsNullable, jsonSerializerOptions); + } if (nullableClass.ObjectNullablePropOption.IsSet) if (nullableClass.ObjectNullablePropOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs index 437b51c29fd5..3c64766aa748 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/Order.cs @@ -32,21 +32,21 @@ public partial class Order : IValidatableObject /// /// Initializes a new instance of the class. /// + /// complete (default to false) /// id /// petId /// quantity /// shipDate /// Order Status - /// complete (default to false) [JsonConstructor] - public Order(Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default, Option complete = default) + public Order(Option complete = default, Option id = default, Option petId = default, Option quantity = default, Option shipDate = default, Option status = default) { + CompleteOption = complete; IdOption = id; PetIdOption = petId; QuantityOption = quantity; ShipDateOption = shipDate; StatusOption = status; - CompleteOption = complete; OnCreated(); } @@ -147,6 +147,19 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("status")] public StatusEnum? Status { get { return this.StatusOption; } set { this.StatusOption = new Option(value); } } + /// + /// Used to track the state of Complete + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option CompleteOption { get; private set; } + + /// + /// Gets or Sets Complete + /// + [JsonPropertyName("complete")] + public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new Option(value); } } + /// /// Used to track the state of Id /// @@ -200,19 +213,6 @@ public static string StatusEnumToJsonValue(StatusEnum? value) [JsonPropertyName("shipDate")] public DateTime? ShipDate { get { return this. ShipDateOption; } set { this.ShipDateOption = new Option(value); } } - /// - /// Used to track the state of Complete - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option CompleteOption { get; private set; } - - /// - /// Gets or Sets Complete - /// - [JsonPropertyName("complete")] - public bool? Complete { get { return this. CompleteOption; } set { this.CompleteOption = new Option(value); } } - /// /// Gets or Sets additional properties /// @@ -227,12 +227,12 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class Order {\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" PetId: ").Append(PetId).Append("\n"); sb.Append(" Quantity: ").Append(Quantity).Append("\n"); sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -276,12 +276,12 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option complete = default; Option id = default; Option petId = default; Option quantity = default; Option shipDate = default; Option status = default; - Option complete = default; while (utf8JsonReader.Read()) { @@ -298,6 +298,10 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert switch (localVarJsonPropertyName) { + case "complete": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + complete = new Option(utf8JsonReader.GetBoolean()); + break; case "id": if (utf8JsonReader.TokenType != JsonTokenType.Null) id = new Option(utf8JsonReader.GetInt64()); @@ -319,16 +323,15 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (statusRawValue != null) status = new Option(Order.StatusEnumFromStringOrDefault(statusRawValue)); break; - case "complete": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - complete = new Option(utf8JsonReader.GetBoolean()); - break; default: break; } } } + if (complete.IsSet && complete.Value == null) + throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); + if (id.IsSet && id.Value == null) throw new ArgumentNullException(nameof(id), "Property is not nullable for class Order."); @@ -344,10 +347,7 @@ public override Order Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert if (status.IsSet && status.Value == null) throw new ArgumentNullException(nameof(status), "Property is not nullable for class Order."); - if (complete.IsSet && complete.Value == null) - throw new ArgumentNullException(nameof(complete), "Property is not nullable for class Order."); - - return new Order(id, petId, quantity, shipDate, status, complete); + return new Order(complete, id, petId, quantity, shipDate, status); } /// @@ -374,6 +374,9 @@ public override void Write(Utf8JsonWriter writer, Order order, JsonSerializerOpt /// public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializerOptions jsonSerializerOptions) { + if (order.CompleteOption.IsSet) + writer.WriteBoolean("complete", order.CompleteOption.Value.Value); + if (order.IdOption.IsSet) writer.WriteNumber("id", order.IdOption.Value.Value); @@ -391,9 +394,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, Order order, JsonSerializ writer.WriteString("status", statusRawValue); else writer.WriteNull("status"); - - if (order.CompleteOption.IsSet) - writer.WriteBoolean("complete", order.CompleteOption.Value.Value); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs index 3f8a9f593e41..f72773b3ffcc 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/RequiredClass.cs @@ -43,17 +43,6 @@ public partial class RequiredClass : IValidatableObject /// requiredNotnullableStringProp /// requiredNotnullableUuid /// requiredNotnullableintegerProp - /// notRequiredNotnullableDateProp - /// notRequiredNotnullableintegerProp - /// notrequiredNotnullableArrayOfString - /// notrequiredNotnullableBooleanProp - /// notrequiredNotnullableDatetimeProp - /// notrequiredNotnullableEnumInteger - /// notrequiredNotnullableEnumIntegerOnly - /// notrequiredNotnullableEnumString - /// notrequiredNotnullableOuterEnumDefaultValue - /// notrequiredNotnullableStringProp - /// notrequiredNotnullableUuid /// requiredNullableArrayOfString /// requiredNullableBooleanProp /// requiredNullableDateProp @@ -65,8 +54,19 @@ public partial class RequiredClass : IValidatableObject /// requiredNullableOuterEnumDefaultValue /// requiredNullableStringProp /// requiredNullableUuid + /// notRequiredNotnullableDateProp + /// notRequiredNotnullableintegerProp /// notRequiredNullableDateProp /// notRequiredNullableIntegerProp + /// notrequiredNotnullableArrayOfString + /// notrequiredNotnullableBooleanProp + /// notrequiredNotnullableDatetimeProp + /// notrequiredNotnullableEnumInteger + /// notrequiredNotnullableEnumIntegerOnly + /// notrequiredNotnullableEnumString + /// notrequiredNotnullableOuterEnumDefaultValue + /// notrequiredNotnullableStringProp + /// notrequiredNotnullableUuid /// notrequiredNullableArrayOfString /// notrequiredNullableBooleanProp /// notrequiredNullableDatetimeProp @@ -77,7 +77,7 @@ public partial class RequiredClass : IValidatableObject /// notrequiredNullableStringProp /// notrequiredNullableUuid [JsonConstructor] - public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) + public RequiredClass(DateTime requiredNotNullableDateProp, List requiredNotnullableArrayOfString, bool requiredNotnullableBooleanProp, DateTime requiredNotnullableDatetimeProp, RequiredNotnullableEnumIntegerEnum requiredNotnullableEnumInteger, RequiredNotnullableEnumIntegerOnlyEnum requiredNotnullableEnumIntegerOnly, RequiredNotnullableEnumStringEnum requiredNotnullableEnumString, OuterEnumDefaultValue requiredNotnullableOuterEnumDefaultValue, string requiredNotnullableStringProp, Guid requiredNotnullableUuid, int requiredNotnullableintegerProp, List requiredNullableArrayOfString = default, bool? requiredNullableBooleanProp = default, DateTime? requiredNullableDateProp = default, DateTime? requiredNullableDatetimeProp = default, RequiredNullableEnumIntegerEnum? requiredNullableEnumInteger = default, RequiredNullableEnumIntegerOnlyEnum? requiredNullableEnumIntegerOnly = default, RequiredNullableEnumStringEnum? requiredNullableEnumString = default, int? requiredNullableIntegerProp = default, OuterEnumDefaultValue? requiredNullableOuterEnumDefaultValue = default, string requiredNullableStringProp = default, Guid? requiredNullableUuid = default, Option notRequiredNotnullableDateProp = default, Option notRequiredNotnullableintegerProp = default, Option notRequiredNullableDateProp = default, Option notRequiredNullableIntegerProp = default, Option> notrequiredNotnullableArrayOfString = default, Option notrequiredNotnullableBooleanProp = default, Option notrequiredNotnullableDatetimeProp = default, Option notrequiredNotnullableEnumInteger = default, Option notrequiredNotnullableEnumIntegerOnly = default, Option notrequiredNotnullableEnumString = default, Option notrequiredNotnullableOuterEnumDefaultValue = default, Option notrequiredNotnullableStringProp = default, Option notrequiredNotnullableUuid = default, Option> notrequiredNullableArrayOfString = default, Option notrequiredNullableBooleanProp = default, Option notrequiredNullableDatetimeProp = default, Option notrequiredNullableEnumInteger = default, Option notrequiredNullableEnumIntegerOnly = default, Option notrequiredNullableEnumString = default, Option notrequiredNullableOuterEnumDefaultValue = default, Option notrequiredNullableStringProp = default, Option notrequiredNullableUuid = default) { RequiredNotNullableDateProp = requiredNotNullableDateProp; RequiredNotnullableArrayOfString = requiredNotnullableArrayOfString; @@ -90,17 +90,6 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNotnullableStringProp = requiredNotnullableStringProp; RequiredNotnullableUuid = requiredNotnullableUuid; RequiredNotnullableintegerProp = requiredNotnullableintegerProp; - NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; - NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; - NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; - NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; - NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; - NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; - NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; - NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; - NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; - NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; - NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; RequiredNullableArrayOfString = requiredNullableArrayOfString; RequiredNullableBooleanProp = requiredNullableBooleanProp; RequiredNullableDateProp = requiredNullableDateProp; @@ -112,8 +101,19 @@ public RequiredClass(DateTime requiredNotNullableDateProp, List required RequiredNullableOuterEnumDefaultValue = requiredNullableOuterEnumDefaultValue; RequiredNullableStringProp = requiredNullableStringProp; RequiredNullableUuid = requiredNullableUuid; + NotRequiredNotnullableDatePropOption = notRequiredNotnullableDateProp; + NotRequiredNotnullableintegerPropOption = notRequiredNotnullableintegerProp; NotRequiredNullableDatePropOption = notRequiredNullableDateProp; NotRequiredNullableIntegerPropOption = notRequiredNullableIntegerProp; + NotrequiredNotnullableArrayOfStringOption = notrequiredNotnullableArrayOfString; + NotrequiredNotnullableBooleanPropOption = notrequiredNotnullableBooleanProp; + NotrequiredNotnullableDatetimePropOption = notrequiredNotnullableDatetimeProp; + NotrequiredNotnullableEnumIntegerOption = notrequiredNotnullableEnumInteger; + NotrequiredNotnullableEnumIntegerOnlyOption = notrequiredNotnullableEnumIntegerOnly; + NotrequiredNotnullableEnumStringOption = notrequiredNotnullableEnumString; + NotrequiredNotnullableOuterEnumDefaultValueOption = notrequiredNotnullableOuterEnumDefaultValue; + NotrequiredNotnullableStringPropOption = notrequiredNotnullableStringProp; + NotrequiredNotnullableUuidOption = notrequiredNotnullableUuid; NotrequiredNullableArrayOfStringOption = notrequiredNullableArrayOfString; NotrequiredNullableBooleanPropOption = notrequiredNullableBooleanProp; NotrequiredNullableDatetimePropOption = notrequiredNullableDatetimeProp; @@ -421,9 +421,9 @@ public static string RequiredNotnullableEnumStringEnumToJsonValue(RequiredNotnul public OuterEnumDefaultValue RequiredNotnullableOuterEnumDefaultValue { get; set; } /// - /// Defines NotrequiredNotnullableEnumInteger + /// Defines RequiredNullableEnumInteger /// - public enum NotrequiredNotnullableEnumIntegerEnum + public enum RequiredNullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -437,65 +437,58 @@ public enum NotrequiredNotnullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) + public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; + return RequiredNullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; + return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) + public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumInteger - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumInteger + /// Gets or Sets RequiredNullableEnumInteger /// - [JsonPropertyName("notrequired_notnullable_enum_integer")] - public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new Option(value); } } + [JsonPropertyName("required_nullable_enum_integer")] + public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } /// - /// Defines NotrequiredNotnullableEnumIntegerOnly + /// Defines RequiredNullableEnumIntegerOnly /// - public enum NotrequiredNotnullableEnumIntegerOnlyEnum + public enum RequiredNullableEnumIntegerOnlyEnum { /// /// Enum NUMBER_2 for value: 2 @@ -509,65 +502,58 @@ public enum NotrequiredNotnullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) + public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) + public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly + /// Gets or Sets RequiredNullableEnumIntegerOnly /// - [JsonPropertyName("notrequired_notnullable_enum_integer_only")] - public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new Option(value); } } + [JsonPropertyName("required_nullable_enum_integer_only")] + public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } /// - /// Defines NotrequiredNotnullableEnumString + /// Defines RequiredNullableEnumString /// - public enum NotrequiredNotnullableEnumStringEnum + public enum RequiredNullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -611,139 +597,128 @@ public enum NotrequiredNotnullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) + public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) + public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return NotrequiredNotnullableEnumStringEnum.UPPER; + return RequiredNullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return NotrequiredNotnullableEnumStringEnum.Lower; + return RequiredNullableEnumStringEnum.Lower; if (value.Equals("")) - return NotrequiredNotnullableEnumStringEnum.Empty; + return RequiredNullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return NotrequiredNotnullableEnumStringEnum.ValuewithTab; + return RequiredNullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; + return RequiredNullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; + return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; + return RequiredNullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; + return RequiredNullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) + public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) { - if (value == NotrequiredNotnullableEnumStringEnum.UPPER) + if (value == null) + return null; + + if (value == RequiredNullableEnumStringEnum.UPPER) return "UPPER"; - if (value == NotrequiredNotnullableEnumStringEnum.Lower) + if (value == RequiredNullableEnumStringEnum.Lower) return "lower"; - if (value == NotrequiredNotnullableEnumStringEnum.Empty) + if (value == RequiredNullableEnumStringEnum.Empty) return ""; - if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) + if (value == RequiredNullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) + if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) + if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Used to track the state of NotrequiredNotnullableEnumString - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableEnumStringOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableEnumString - /// - [JsonPropertyName("notrequired_notnullable_enum_string")] - public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new Option(value); } } - - /// - /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableEnumString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + [JsonPropertyName("required_nullable_enum_string")] + public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } /// - /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// Gets or Sets RequiredNullableOuterEnumDefaultValue /// - [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new Option(value); } } + [JsonPropertyName("required_nullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } /// - /// Defines RequiredNullableEnumInteger + /// Defines NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerEnum + public enum NotrequiredNotnullableEnumIntegerEnum { /// /// Enum NUMBER_1 for value: 1 @@ -757,61 +732,68 @@ public enum RequiredNullableEnumIntegerEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerEnum RequiredNullableEnumIntegerEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerEnum NotrequiredNotnullableEnumIntegerEnumFromString(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerEnum? RequiredNullableEnumIntegerEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumIntegerEnumFromStringOrDefault(string value) { if (value.Equals((1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_1; if (value.Equals((-1).ToString())) - return RequiredNullableEnumIntegerEnum.NUMBER_MINUS_1; + return NotrequiredNotnullableEnumIntegerEnum.NUMBER_MINUS_1; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerEnumToJsonValue(RequiredNullableEnumIntegerEnum value) + public static int NotrequiredNotnullableEnumIntegerEnumToJsonValue(NotrequiredNotnullableEnumIntegerEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumInteger + /// Used to track the state of NotrequiredNotnullableEnumInteger /// - [JsonPropertyName("required_nullable_enum_integer")] - public RequiredNullableEnumIntegerEnum? RequiredNullableEnumInteger { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOption { get; private set; } /// - /// Defines RequiredNullableEnumIntegerOnly + /// Gets or Sets NotrequiredNotnullableEnumInteger /// - public enum RequiredNullableEnumIntegerOnlyEnum - { - /// - /// Enum NUMBER_2 for value: 2 + [JsonPropertyName("notrequired_notnullable_enum_integer")] + public NotrequiredNotnullableEnumIntegerEnum? NotrequiredNotnullableEnumInteger { get { return this.NotrequiredNotnullableEnumIntegerOption; } set { this.NotrequiredNotnullableEnumIntegerOption = new Option(value); } } + + /// + /// Defines NotrequiredNotnullableEnumIntegerOnly + /// + public enum NotrequiredNotnullableEnumIntegerOnlyEnum + { + /// + /// Enum NUMBER_2 for value: 2 /// NUMBER_2 = 2, @@ -822,58 +804,65 @@ public enum RequiredNullableEnumIntegerOnlyEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum RequiredNullableEnumIntegerOnlyEnumFromString(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum NotrequiredNotnullableEnumIntegerOnlyEnumFromString(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumIntegerOnlyEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumIntegerOnlyEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnlyEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnlyEnumFromStringOrDefault(string value) { if (value.Equals((2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_2; if (value.Equals((-2).ToString())) - return RequiredNullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; + return NotrequiredNotnullableEnumIntegerOnlyEnum.NUMBER_MINUS_2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// - public static int RequiredNullableEnumIntegerOnlyEnumToJsonValue(RequiredNullableEnumIntegerOnlyEnum value) + public static int NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(NotrequiredNotnullableEnumIntegerOnlyEnum value) { return (int) value; } /// - /// Gets or Sets RequiredNullableEnumIntegerOnly + /// Used to track the state of NotrequiredNotnullableEnumIntegerOnly /// - [JsonPropertyName("required_nullable_enum_integer_only")] - public RequiredNullableEnumIntegerOnlyEnum? RequiredNullableEnumIntegerOnly { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumIntegerOnlyOption { get; private set; } /// - /// Defines RequiredNullableEnumString + /// Gets or Sets NotrequiredNotnullableEnumIntegerOnly /// - public enum RequiredNullableEnumStringEnum + [JsonPropertyName("notrequired_notnullable_enum_integer_only")] + public NotrequiredNotnullableEnumIntegerOnlyEnum? NotrequiredNotnullableEnumIntegerOnly { get { return this.NotrequiredNotnullableEnumIntegerOnlyOption; } set { this.NotrequiredNotnullableEnumIntegerOnlyOption = new Option(value); } } + + /// + /// Defines NotrequiredNotnullableEnumString + /// + public enum NotrequiredNotnullableEnumStringEnum { /// /// Enum UPPER for value: UPPER @@ -917,123 +906,134 @@ public enum RequiredNullableEnumStringEnum } /// - /// Returns a + /// Returns a /// /// /// /// - public static RequiredNullableEnumStringEnum RequiredNullableEnumStringEnumFromString(string value) + public static NotrequiredNotnullableEnumStringEnum NotrequiredNotnullableEnumStringEnumFromString(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; - throw new NotImplementedException($"Could not convert value to type RequiredNullableEnumStringEnum: '{value}'"); + throw new NotImplementedException($"Could not convert value to type NotrequiredNotnullableEnumStringEnum: '{value}'"); } /// - /// Returns a + /// Returns a /// /// /// - public static RequiredNullableEnumStringEnum? RequiredNullableEnumStringEnumFromStringOrDefault(string value) + public static NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumStringEnumFromStringOrDefault(string value) { if (value.Equals("UPPER")) - return RequiredNullableEnumStringEnum.UPPER; + return NotrequiredNotnullableEnumStringEnum.UPPER; if (value.Equals("lower")) - return RequiredNullableEnumStringEnum.Lower; + return NotrequiredNotnullableEnumStringEnum.Lower; if (value.Equals("")) - return RequiredNullableEnumStringEnum.Empty; + return NotrequiredNotnullableEnumStringEnum.Empty; if (value.Equals("Value\twith tab")) - return RequiredNullableEnumStringEnum.ValuewithTab; + return NotrequiredNotnullableEnumStringEnum.ValuewithTab; if (value.Equals("Value with \" quote")) - return RequiredNullableEnumStringEnum.ValueWithQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithQuote; if (value.Equals("Value with escaped \" quote")) - return RequiredNullableEnumStringEnum.ValueWithEscapedQuote; + return NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote; if (value.Equals("Duplicate\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue; if (value.Equals("Duplicate\r\nvalue")) - return RequiredNullableEnumStringEnum.Duplicatevalue2; + return NotrequiredNotnullableEnumStringEnum.Duplicatevalue2; return null; } /// - /// Converts the to the json value + /// Converts the to the json value /// /// /// /// - public static string RequiredNullableEnumStringEnumToJsonValue(RequiredNullableEnumStringEnum? value) + public static string NotrequiredNotnullableEnumStringEnumToJsonValue(NotrequiredNotnullableEnumStringEnum? value) { - if (value == null) - return null; - - if (value == RequiredNullableEnumStringEnum.UPPER) + if (value == NotrequiredNotnullableEnumStringEnum.UPPER) return "UPPER"; - if (value == RequiredNullableEnumStringEnum.Lower) + if (value == NotrequiredNotnullableEnumStringEnum.Lower) return "lower"; - if (value == RequiredNullableEnumStringEnum.Empty) + if (value == NotrequiredNotnullableEnumStringEnum.Empty) return ""; - if (value == RequiredNullableEnumStringEnum.ValuewithTab) + if (value == NotrequiredNotnullableEnumStringEnum.ValuewithTab) return "Value\twith tab"; - if (value == RequiredNullableEnumStringEnum.ValueWithQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithQuote) return "Value with \" quote"; - if (value == RequiredNullableEnumStringEnum.ValueWithEscapedQuote) + if (value == NotrequiredNotnullableEnumStringEnum.ValueWithEscapedQuote) return "Value with escaped \" quote"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue) return "Duplicate\nvalue"; - if (value == RequiredNullableEnumStringEnum.Duplicatevalue2) + if (value == NotrequiredNotnullableEnumStringEnum.Duplicatevalue2) return "Duplicate\r\nvalue"; throw new NotImplementedException($"Value could not be handled: '{value}'"); } /// - /// Gets or Sets RequiredNullableEnumString + /// Used to track the state of NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_enum_string")] - public RequiredNullableEnumStringEnum? RequiredNullableEnumString { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableEnumStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableOuterEnumDefaultValue + /// Gets or Sets NotrequiredNotnullableEnumString /// - [JsonPropertyName("required_nullable_outerEnumDefaultValue")] - public OuterEnumDefaultValue? RequiredNullableOuterEnumDefaultValue { get; set; } + [JsonPropertyName("notrequired_notnullable_enum_string")] + public NotrequiredNotnullableEnumStringEnum? NotrequiredNotnullableEnumString { get { return this.NotrequiredNotnullableEnumStringOption; } set { this.NotrequiredNotnullableEnumStringOption = new Option(value); } } + + /// + /// Used to track the state of NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableOuterEnumDefaultValueOption { get; private set; } + + /// + /// Gets or Sets NotrequiredNotnullableOuterEnumDefaultValue + /// + [JsonPropertyName("notrequired_notnullable_outerEnumDefaultValue")] + public OuterEnumDefaultValue? NotrequiredNotnullableOuterEnumDefaultValue { get { return this.NotrequiredNotnullableOuterEnumDefaultValueOption; } set { this.NotrequiredNotnullableOuterEnumDefaultValueOption = new Option(value); } } /// /// Defines NotrequiredNullableEnumInteger @@ -1402,165 +1402,165 @@ public static string NotrequiredNullableEnumStringEnumToJsonValue(NotrequiredNul public int RequiredNotnullableintegerProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableArrayOfString /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableDatePropOption { get; private set; } + [JsonPropertyName("required_nullable_array_of_string")] + public List RequiredNullableArrayOfString { get; set; } /// - /// Gets or Sets NotRequiredNotnullableDateProp + /// Gets or Sets RequiredNullableBooleanProp /// - [JsonPropertyName("not_required_notnullable_date_prop")] - public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new Option(value); } } + [JsonPropertyName("required_nullable_boolean_prop")] + public bool? RequiredNullableBooleanProp { get; set; } /// - /// Used to track the state of NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDateProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNotnullableintegerPropOption { get; private set; } + [JsonPropertyName("required_nullable_date_prop")] + public DateTime? RequiredNullableDateProp { get; set; } /// - /// Gets or Sets NotRequiredNotnullableintegerProp + /// Gets or Sets RequiredNullableDatetimeProp /// - [JsonPropertyName("not_required_notnullableinteger_prop")] - public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new Option(value); } } + [JsonPropertyName("required_nullable_datetime_prop")] + public DateTime? RequiredNullableDatetimeProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableIntegerProp /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } + [JsonPropertyName("required_nullable_integer_prop")] + public int? RequiredNullableIntegerProp { get; set; } /// - /// Gets or Sets NotrequiredNotnullableArrayOfString + /// Gets or Sets RequiredNullableStringProp /// - [JsonPropertyName("notrequired_notnullable_array_of_string")] - public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new Option>(value); } } + [JsonPropertyName("required_nullable_string_prop")] + public string RequiredNullableStringProp { get; set; } /// - /// Used to track the state of NotrequiredNotnullableBooleanProp + /// Gets or Sets RequiredNullableUuid + /// + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("required_nullable_uuid")] + public Guid? RequiredNullableUuid { get; set; } + + /// + /// Used to track the state of NotRequiredNotnullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableBooleanPropOption { get; private set; } + public Option NotRequiredNotnullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableBooleanProp + /// Gets or Sets NotRequiredNotnullableDateProp /// - [JsonPropertyName("notrequired_notnullable_boolean_prop")] - public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new Option(value); } } + [JsonPropertyName("not_required_notnullable_date_prop")] + public DateTime? NotRequiredNotnullableDateProp { get { return this. NotRequiredNotnullableDatePropOption; } set { this.NotRequiredNotnullableDatePropOption = new Option(value); } } /// - /// Used to track the state of NotrequiredNotnullableDatetimeProp + /// Used to track the state of NotRequiredNotnullableintegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableDatetimePropOption { get; private set; } + public Option NotRequiredNotnullableintegerPropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableDatetimeProp + /// Gets or Sets NotRequiredNotnullableintegerProp /// - [JsonPropertyName("notrequired_notnullable_datetime_prop")] - public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new Option(value); } } + [JsonPropertyName("not_required_notnullableinteger_prop")] + public int? NotRequiredNotnullableintegerProp { get { return this. NotRequiredNotnullableintegerPropOption; } set { this.NotRequiredNotnullableintegerPropOption = new Option(value); } } /// - /// Used to track the state of NotrequiredNotnullableStringProp + /// Used to track the state of NotRequiredNullableDateProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableStringPropOption { get; private set; } + public Option NotRequiredNullableDatePropOption { get; private set; } /// - /// Gets or Sets NotrequiredNotnullableStringProp + /// Gets or Sets NotRequiredNullableDateProp /// - [JsonPropertyName("notrequired_notnullable_string_prop")] - public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new Option(value); } } + [JsonPropertyName("not_required_nullable_date_prop")] + public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new Option(value); } } /// - /// Used to track the state of NotrequiredNotnullableUuid + /// Used to track the state of NotRequiredNullableIntegerProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotrequiredNotnullableUuidOption { get; private set; } - - /// - /// Gets or Sets NotrequiredNotnullableUuid - /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("notrequired_notnullable_uuid")] - public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option(value); } } + public Option NotRequiredNullableIntegerPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableArrayOfString + /// Gets or Sets NotRequiredNullableIntegerProp /// - [JsonPropertyName("required_nullable_array_of_string")] - public List RequiredNullableArrayOfString { get; set; } + [JsonPropertyName("not_required_nullable_integer_prop")] + public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new Option(value); } } /// - /// Gets or Sets RequiredNullableBooleanProp + /// Used to track the state of NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_boolean_prop")] - public bool? RequiredNullableBooleanProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option> NotrequiredNotnullableArrayOfStringOption { get; private set; } /// - /// Gets or Sets RequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableArrayOfString /// - [JsonPropertyName("required_nullable_date_prop")] - public DateTime? RequiredNullableDateProp { get; set; } + [JsonPropertyName("notrequired_notnullable_array_of_string")] + public List NotrequiredNotnullableArrayOfString { get { return this. NotrequiredNotnullableArrayOfStringOption; } set { this.NotrequiredNotnullableArrayOfStringOption = new Option>(value); } } /// - /// Gets or Sets RequiredNullableDatetimeProp + /// Used to track the state of NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_datetime_prop")] - public DateTime? RequiredNullableDatetimeProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableBooleanPropOption { get; private set; } /// - /// Gets or Sets RequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableBooleanProp /// - [JsonPropertyName("required_nullable_integer_prop")] - public int? RequiredNullableIntegerProp { get; set; } + [JsonPropertyName("notrequired_notnullable_boolean_prop")] + public bool? NotrequiredNotnullableBooleanProp { get { return this. NotrequiredNotnullableBooleanPropOption; } set { this.NotrequiredNotnullableBooleanPropOption = new Option(value); } } /// - /// Gets or Sets RequiredNullableStringProp + /// Used to track the state of NotrequiredNotnullableDatetimeProp /// - [JsonPropertyName("required_nullable_string_prop")] - public string RequiredNullableStringProp { get; set; } + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option NotrequiredNotnullableDatetimePropOption { get; private set; } /// - /// Gets or Sets RequiredNullableUuid + /// Gets or Sets NotrequiredNotnullableDatetimeProp /// - /// 72f98069-206d-4f12-9f12-3d1e525a8e84 - [JsonPropertyName("required_nullable_uuid")] - public Guid? RequiredNullableUuid { get; set; } + [JsonPropertyName("notrequired_notnullable_datetime_prop")] + public DateTime? NotrequiredNotnullableDatetimeProp { get { return this. NotrequiredNotnullableDatetimePropOption; } set { this.NotrequiredNotnullableDatetimePropOption = new Option(value); } } /// - /// Used to track the state of NotRequiredNullableDateProp + /// Used to track the state of NotrequiredNotnullableStringProp /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableDatePropOption { get; private set; } + public Option NotrequiredNotnullableStringPropOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableDateProp + /// Gets or Sets NotrequiredNotnullableStringProp /// - [JsonPropertyName("not_required_nullable_date_prop")] - public DateTime? NotRequiredNullableDateProp { get { return this. NotRequiredNullableDatePropOption; } set { this.NotRequiredNullableDatePropOption = new Option(value); } } + [JsonPropertyName("notrequired_notnullable_string_prop")] + public string NotrequiredNotnullableStringProp { get { return this. NotrequiredNotnullableStringPropOption; } set { this.NotrequiredNotnullableStringPropOption = new Option(value); } } /// - /// Used to track the state of NotRequiredNullableIntegerProp + /// Used to track the state of NotrequiredNotnullableUuid /// [JsonIgnore] [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option NotRequiredNullableIntegerPropOption { get; private set; } + public Option NotrequiredNotnullableUuidOption { get; private set; } /// - /// Gets or Sets NotRequiredNullableIntegerProp + /// Gets or Sets NotrequiredNotnullableUuid /// - [JsonPropertyName("not_required_nullable_integer_prop")] - public int? NotRequiredNullableIntegerProp { get { return this. NotRequiredNullableIntegerPropOption; } set { this.NotRequiredNullableIntegerPropOption = new Option(value); } } + /// 72f98069-206d-4f12-9f12-3d1e525a8e84 + [JsonPropertyName("notrequired_notnullable_uuid")] + public Guid? NotrequiredNotnullableUuid { get { return this. NotrequiredNotnullableUuidOption; } set { this.NotrequiredNotnullableUuidOption = new Option(value); } } /// /// Used to track the state of NotrequiredNullableArrayOfString @@ -1653,17 +1653,6 @@ public override string ToString() sb.Append(" RequiredNotnullableStringProp: ").Append(RequiredNotnullableStringProp).Append("\n"); sb.Append(" RequiredNotnullableUuid: ").Append(RequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNotnullableintegerProp: ").Append(RequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); - sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); - sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); - sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); - sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); - sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); - sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); - sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); - sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" RequiredNullableArrayOfString: ").Append(RequiredNullableArrayOfString).Append("\n"); sb.Append(" RequiredNullableBooleanProp: ").Append(RequiredNullableBooleanProp).Append("\n"); sb.Append(" RequiredNullableDateProp: ").Append(RequiredNullableDateProp).Append("\n"); @@ -1675,8 +1664,19 @@ public override string ToString() sb.Append(" RequiredNullableOuterEnumDefaultValue: ").Append(RequiredNullableOuterEnumDefaultValue).Append("\n"); sb.Append(" RequiredNullableStringProp: ").Append(RequiredNullableStringProp).Append("\n"); sb.Append(" RequiredNullableUuid: ").Append(RequiredNullableUuid).Append("\n"); + sb.Append(" NotRequiredNotnullableDateProp: ").Append(NotRequiredNotnullableDateProp).Append("\n"); + sb.Append(" NotRequiredNotnullableintegerProp: ").Append(NotRequiredNotnullableintegerProp).Append("\n"); sb.Append(" NotRequiredNullableDateProp: ").Append(NotRequiredNullableDateProp).Append("\n"); sb.Append(" NotRequiredNullableIntegerProp: ").Append(NotRequiredNullableIntegerProp).Append("\n"); + sb.Append(" NotrequiredNotnullableArrayOfString: ").Append(NotrequiredNotnullableArrayOfString).Append("\n"); + sb.Append(" NotrequiredNotnullableBooleanProp: ").Append(NotrequiredNotnullableBooleanProp).Append("\n"); + sb.Append(" NotrequiredNotnullableDatetimeProp: ").Append(NotrequiredNotnullableDatetimeProp).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumInteger: ").Append(NotrequiredNotnullableEnumInteger).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumIntegerOnly: ").Append(NotrequiredNotnullableEnumIntegerOnly).Append("\n"); + sb.Append(" NotrequiredNotnullableEnumString: ").Append(NotrequiredNotnullableEnumString).Append("\n"); + sb.Append(" NotrequiredNotnullableOuterEnumDefaultValue: ").Append(NotrequiredNotnullableOuterEnumDefaultValue).Append("\n"); + sb.Append(" NotrequiredNotnullableStringProp: ").Append(NotrequiredNotnullableStringProp).Append("\n"); + sb.Append(" NotrequiredNotnullableUuid: ").Append(NotrequiredNotnullableUuid).Append("\n"); sb.Append(" NotrequiredNullableArrayOfString: ").Append(NotrequiredNullableArrayOfString).Append("\n"); sb.Append(" NotrequiredNullableBooleanProp: ").Append(NotrequiredNullableBooleanProp).Append("\n"); sb.Append(" NotrequiredNullableDatetimeProp: ").Append(NotrequiredNullableDatetimeProp).Append("\n"); @@ -1717,16 +1717,6 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// - /// The format to use to serialize NotRequiredNotnullableDateProp - /// - public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; - - /// - /// The format to use to serialize NotrequiredNotnullableDatetimeProp - /// - public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; - /// /// The format to use to serialize RequiredNullableDateProp /// @@ -1737,11 +1727,21 @@ public class RequiredClassJsonConverter : JsonConverter /// public static string RequiredNullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// + /// The format to use to serialize NotRequiredNotnullableDateProp + /// + public static string NotRequiredNotnullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// /// The format to use to serialize NotRequiredNullableDateProp /// public static string NotRequiredNullableDatePropFormat { get; set; } = "yyyy'-'MM'-'dd"; + /// + /// The format to use to serialize NotrequiredNotnullableDatetimeProp + /// + public static string NotrequiredNotnullableDatetimePropFormat { get; set; } = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffK"; + /// /// The format to use to serialize NotrequiredNullableDatetimeProp /// @@ -1775,17 +1775,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNotnullableStringProp = default; Option requiredNotnullableUuid = default; Option requiredNotnullableintegerProp = default; - Option notRequiredNotnullableDateProp = default; - Option notRequiredNotnullableintegerProp = default; - Option> notrequiredNotnullableArrayOfString = default; - Option notrequiredNotnullableBooleanProp = default; - Option notrequiredNotnullableDatetimeProp = default; - Option notrequiredNotnullableEnumInteger = default; - Option notrequiredNotnullableEnumIntegerOnly = default; - Option notrequiredNotnullableEnumString = default; - Option notrequiredNotnullableOuterEnumDefaultValue = default; - Option notrequiredNotnullableStringProp = default; - Option notrequiredNotnullableUuid = default; Option> requiredNullableArrayOfString = default; Option requiredNullableBooleanProp = default; Option requiredNullableDateProp = default; @@ -1797,8 +1786,19 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT Option requiredNullableOuterEnumDefaultValue = default; Option requiredNullableStringProp = default; Option requiredNullableUuid = default; + Option notRequiredNotnullableDateProp = default; + Option notRequiredNotnullableintegerProp = default; Option notRequiredNullableDateProp = default; Option notRequiredNullableIntegerProp = default; + Option> notrequiredNotnullableArrayOfString = default; + Option notrequiredNotnullableBooleanProp = default; + Option notrequiredNotnullableDatetimeProp = default; + Option notrequiredNotnullableEnumInteger = default; + Option notrequiredNotnullableEnumIntegerOnly = default; + Option notrequiredNotnullableEnumString = default; + Option notrequiredNotnullableOuterEnumDefaultValue = default; + Option notrequiredNotnullableStringProp = default; + Option notrequiredNotnullableUuid = default; Option> notrequiredNullableArrayOfString = default; Option notrequiredNullableBooleanProp = default; Option notrequiredNullableDatetimeProp = default; @@ -1869,51 +1869,6 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); break; - case "not_required_notnullable_date_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "not_required_notnullableinteger_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_array_of_string": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "notrequired_notnullable_boolean_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); - break; - case "notrequired_notnullable_datetime_prop": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - 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()); - break; - case "notrequired_notnullable_enum_integer_only": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); - break; - case "notrequired_notnullable_enum_string": - string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableEnumStringRawValue != null) - notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); - break; - case "notrequired_notnullable_outerEnumDefaultValue": - string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); - if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) - notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); - break; - case "notrequired_notnullable_string_prop": - notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); - break; - case "notrequired_notnullable_uuid": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); - break; case "required_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -1959,6 +1914,14 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) requiredNullableUuid = new Option(utf8JsonReader.GetGuid()); break; + case "not_required_notnullable_date_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "not_required_notnullableinteger_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notRequiredNotnullableintegerProp = new Option(utf8JsonReader.GetInt32()); + break; case "not_required_nullable_date_prop": if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableDateProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); @@ -1967,6 +1930,43 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (utf8JsonReader.TokenType != JsonTokenType.Null) notRequiredNullableIntegerProp = new Option(utf8JsonReader.GetInt32()); break; + case "notrequired_notnullable_array_of_string": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); + break; + case "notrequired_notnullable_boolean_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableBooleanProp = new Option(utf8JsonReader.GetBoolean()); + break; + case "notrequired_notnullable_datetime_prop": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + 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()); + break; + case "notrequired_notnullable_enum_integer_only": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableEnumIntegerOnly = new Option((RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnum)utf8JsonReader.GetInt32()); + break; + case "notrequired_notnullable_enum_string": + string notrequiredNotnullableEnumStringRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableEnumStringRawValue != null) + notrequiredNotnullableEnumString = new Option(RequiredClass.NotrequiredNotnullableEnumStringEnumFromStringOrDefault(notrequiredNotnullableEnumStringRawValue)); + break; + case "notrequired_notnullable_outerEnumDefaultValue": + string notrequiredNotnullableOuterEnumDefaultValueRawValue = utf8JsonReader.GetString(); + if (notrequiredNotnullableOuterEnumDefaultValueRawValue != null) + notrequiredNotnullableOuterEnumDefaultValue = new Option(OuterEnumDefaultValueValueConverter.FromStringOrDefault(notrequiredNotnullableOuterEnumDefaultValueRawValue)); + break; + case "notrequired_notnullable_string_prop": + notrequiredNotnullableStringProp = new Option(utf8JsonReader.GetString()); + break; + case "notrequired_notnullable_uuid": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + notrequiredNotnullableUuid = new Option(utf8JsonReader.GetGuid()); + break; case "notrequired_nullable_array_of_string": if (utf8JsonReader.TokenType != JsonTokenType.Null) notrequiredNullableArrayOfString = new Option>(JsonSerializer.Deserialize>(ref utf8JsonReader, jsonSerializerOptions)); @@ -2142,7 +2142,7 @@ public override RequiredClass Read(ref Utf8JsonReader utf8JsonReader, Type typeT if (notrequiredNotnullableUuid.IsSet && notrequiredNotnullableUuid.Value == null) throw new ArgumentNullException(nameof(notrequiredNotnullableUuid), "Property is not nullable for class RequiredClass."); - return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); + return new RequiredClass(requiredNotNullableDateProp.Value.Value, requiredNotnullableArrayOfString.Value, requiredNotnullableBooleanProp.Value.Value, requiredNotnullableDatetimeProp.Value.Value, requiredNotnullableEnumInteger.Value.Value, requiredNotnullableEnumIntegerOnly.Value.Value, requiredNotnullableEnumString.Value.Value, requiredNotnullableOuterEnumDefaultValue.Value.Value, requiredNotnullableStringProp.Value, requiredNotnullableUuid.Value.Value, requiredNotnullableintegerProp.Value.Value, requiredNullableArrayOfString.Value, requiredNullableBooleanProp.Value, requiredNullableDateProp.Value, requiredNullableDatetimeProp.Value, requiredNullableEnumInteger.Value, requiredNullableEnumIntegerOnly.Value, requiredNullableEnumString.Value, requiredNullableIntegerProp.Value, requiredNullableOuterEnumDefaultValue.Value, requiredNullableStringProp.Value, requiredNullableUuid.Value, notRequiredNotnullableDateProp, notRequiredNotnullableintegerProp, notRequiredNullableDateProp, notRequiredNullableIntegerProp, notrequiredNotnullableArrayOfString, notrequiredNotnullableBooleanProp, notrequiredNotnullableDatetimeProp, notrequiredNotnullableEnumInteger, notrequiredNotnullableEnumIntegerOnly, notrequiredNotnullableEnumString, notrequiredNotnullableOuterEnumDefaultValue, notrequiredNotnullableStringProp, notrequiredNotnullableUuid, notrequiredNullableArrayOfString, notrequiredNullableBooleanProp, notrequiredNullableDatetimeProp, notrequiredNullableEnumInteger, notrequiredNullableEnumIntegerOnly, notrequiredNullableEnumString, notrequiredNullableOuterEnumDefaultValue, notrequiredNullableStringProp, notrequiredNullableUuid); } /// @@ -2208,46 +2208,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla writer.WriteNumber("required_notnullableinteger_prop", requiredClass.RequiredNotnullableintegerProp); - if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) - writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); - - if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) - writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); - - if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) - { - writer.WritePropertyName("notrequired_notnullable_array_of_string"); - JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); - } - if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) - writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); - - if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) - writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); - - if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) - writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); - - var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); - if (notrequiredNotnullableEnumStringRawValue != null) - writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); - else - writer.WriteNull("notrequired_notnullable_enum_string"); - - if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) - { - var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); - writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); - } - if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) - writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); - - if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) - writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); - if (requiredClass.RequiredNullableArrayOfString != null) { writer.WritePropertyName("required_nullable_array_of_string"); @@ -2312,6 +2272,12 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("required_nullable_uuid"); + if (requiredClass.NotRequiredNotnullableDatePropOption.IsSet) + writer.WriteString("not_required_notnullable_date_prop", requiredClass.NotRequiredNotnullableDatePropOption.Value.Value.ToString(NotRequiredNotnullableDatePropFormat)); + + if (requiredClass.NotRequiredNotnullableintegerPropOption.IsSet) + writer.WriteNumber("not_required_notnullableinteger_prop", requiredClass.NotRequiredNotnullableintegerPropOption.Value.Value); + if (requiredClass.NotRequiredNullableDatePropOption.IsSet) if (requiredClass.NotRequiredNullableDatePropOption.Value != null) writer.WriteString("not_required_nullable_date_prop", requiredClass.NotRequiredNullableDatePropOption.Value.Value.ToString(NotRequiredNullableDatePropFormat)); @@ -2324,6 +2290,40 @@ public void WriteProperties(ref Utf8JsonWriter writer, RequiredClass requiredCla else writer.WriteNull("not_required_nullable_integer_prop"); + if (requiredClass.NotrequiredNotnullableArrayOfStringOption.IsSet) + { + writer.WritePropertyName("notrequired_notnullable_array_of_string"); + JsonSerializer.Serialize(writer, requiredClass.NotrequiredNotnullableArrayOfString, jsonSerializerOptions); + } + if (requiredClass.NotrequiredNotnullableBooleanPropOption.IsSet) + writer.WriteBoolean("notrequired_notnullable_boolean_prop", requiredClass.NotrequiredNotnullableBooleanPropOption.Value.Value); + + if (requiredClass.NotrequiredNotnullableDatetimePropOption.IsSet) + writer.WriteString("notrequired_notnullable_datetime_prop", requiredClass.NotrequiredNotnullableDatetimePropOption.Value.Value.ToString(NotrequiredNotnullableDatetimePropFormat)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer", RequiredClass.NotrequiredNotnullableEnumIntegerEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOption.Value.Value)); + + if (requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.IsSet) + writer.WriteNumber("notrequired_notnullable_enum_integer_only", RequiredClass.NotrequiredNotnullableEnumIntegerOnlyEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumIntegerOnlyOption.Value.Value)); + + var notrequiredNotnullableEnumStringRawValue = RequiredClass.NotrequiredNotnullableEnumStringEnumToJsonValue(requiredClass.NotrequiredNotnullableEnumStringOption.Value.Value); + if (notrequiredNotnullableEnumStringRawValue != null) + writer.WriteString("notrequired_notnullable_enum_string", notrequiredNotnullableEnumStringRawValue); + else + writer.WriteNull("notrequired_notnullable_enum_string"); + + if (requiredClass.NotrequiredNotnullableOuterEnumDefaultValueOption.IsSet) + { + var notrequiredNotnullableOuterEnumDefaultValueRawValue = OuterEnumDefaultValueValueConverter.ToJsonValue(requiredClass.NotrequiredNotnullableOuterEnumDefaultValue.Value); + writer.WriteString("notrequired_notnullable_outerEnumDefaultValue", notrequiredNotnullableOuterEnumDefaultValueRawValue); + } + if (requiredClass.NotrequiredNotnullableStringPropOption.IsSet) + writer.WriteString("notrequired_notnullable_string_prop", requiredClass.NotrequiredNotnullableStringProp); + + if (requiredClass.NotrequiredNotnullableUuidOption.IsSet) + writer.WriteString("notrequired_notnullable_uuid", requiredClass.NotrequiredNotnullableUuidOption.Value.Value); + if (requiredClass.NotrequiredNullableArrayOfStringOption.IsSet) if (requiredClass.NotrequiredNullableArrayOfStringOption.Value != null) { diff --git a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs index 8ee32ec10c7f..8c8eb5c8434b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs +++ b/samples/client/petstore/csharp/OpenAPIClient-generichost-netstandard2.0/src/Org.OpenAPITools/Model/User.cs @@ -32,38 +32,66 @@ public partial class User : IValidatableObject /// /// Initializes a new instance of the class. /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. /// email /// firstName /// id /// lastName /// test code generation for objects Value must be a map of strings to values. It cannot be the 'null' value. + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. /// password /// phone /// User Status /// username - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. [JsonConstructor] - public User(Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default, Option anyTypeProp = default, Option anyTypePropNullable = default, Option objectWithNoDeclaredPropsNullable = default) + public User(Option anyTypeProp = default, Option anyTypePropNullable = default, Option email = default, Option firstName = default, Option id = default, Option lastName = default, Option objectWithNoDeclaredProps = default, Option objectWithNoDeclaredPropsNullable = default, Option password = default, Option phone = default, Option userStatus = default, Option username = default) { + AnyTypePropOption = anyTypeProp; + AnyTypePropNullableOption = anyTypePropNullable; EmailOption = email; FirstNameOption = firstName; IdOption = id; LastNameOption = lastName; ObjectWithNoDeclaredPropsOption = objectWithNoDeclaredProps; + ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; PasswordOption = password; PhoneOption = phone; UserStatusOption = userStatus; UsernameOption = username; - AnyTypePropOption = anyTypeProp; - AnyTypePropNullableOption = anyTypePropNullable; - ObjectWithNoDeclaredPropsNullableOption = objectWithNoDeclaredPropsNullable; OnCreated(); } partial void OnCreated(); + /// + /// Used to track the state of AnyTypeProp + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 + [JsonPropertyName("anyTypeProp")] + public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new Option(value); } } + + /// + /// Used to track the state of AnyTypePropNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option AnyTypePropNullableOption { get; private set; } + + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + /// + /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. + [JsonPropertyName("anyTypePropNullable")] + public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new Option(value); } } + /// /// Used to track the state of Email /// @@ -130,6 +158,20 @@ public User(Option email = default, Option firstName = default, [JsonPropertyName("objectWithNoDeclaredProps")] public Object ObjectWithNoDeclaredProps { get { return this. ObjectWithNoDeclaredPropsOption; } set { this.ObjectWithNoDeclaredPropsOption = new Option(value); } } + /// + /// Used to track the state of ObjectWithNoDeclaredPropsNullable + /// + [JsonIgnore] + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } + + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + /// + /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. + [JsonPropertyName("objectWithNoDeclaredPropsNullable")] + public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new Option(value); } } + /// /// Used to track the state of Password /// @@ -183,48 +225,6 @@ public User(Option email = default, Option firstName = default, [JsonPropertyName("username")] public string Username { get { return this. UsernameOption; } set { this.UsernameOption = new Option(value); } } - /// - /// Used to track the state of AnyTypeProp - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. See https://github.com/OAI/OpenAPI-Specification/issues/1389 - [JsonPropertyName("anyTypeProp")] - public Object AnyTypeProp { get { return this. AnyTypePropOption; } set { this.AnyTypePropOption = new Option(value); } } - - /// - /// Used to track the state of AnyTypePropNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option AnyTypePropNullableOption { get; private set; } - - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - /// - /// test code generation for any type Here the 'type' attribute is not specified, which means the value can be anything, including the null value, string, number, boolean, array or object. The 'nullable' attribute does not change the allowed values. - [JsonPropertyName("anyTypePropNullable")] - public Object AnyTypePropNullable { get { return this. AnyTypePropNullableOption; } set { this.AnyTypePropNullableOption = new Option(value); } } - - /// - /// Used to track the state of ObjectWithNoDeclaredPropsNullable - /// - [JsonIgnore] - [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] - public Option ObjectWithNoDeclaredPropsNullableOption { get; private set; } - - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - /// - /// test code generation for nullable objects. Value must be a map of strings to values or the 'null' value. - [JsonPropertyName("objectWithNoDeclaredPropsNullable")] - public Object ObjectWithNoDeclaredPropsNullable { get { return this. ObjectWithNoDeclaredPropsNullableOption; } set { this.ObjectWithNoDeclaredPropsNullableOption = new Option(value); } } - /// /// Gets or Sets additional properties /// @@ -239,18 +239,18 @@ public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("class User {\n"); + sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); + sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); sb.Append(" Email: ").Append(Email).Append("\n"); sb.Append(" FirstName: ").Append(FirstName).Append("\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" LastName: ").Append(LastName).Append("\n"); sb.Append(" ObjectWithNoDeclaredProps: ").Append(ObjectWithNoDeclaredProps).Append("\n"); + sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" Password: ").Append(Password).Append("\n"); sb.Append(" Phone: ").Append(Phone).Append("\n"); sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" AnyTypeProp: ").Append(AnyTypeProp).Append("\n"); - sb.Append(" AnyTypePropNullable: ").Append(AnyTypePropNullable).Append("\n"); - sb.Append(" ObjectWithNoDeclaredPropsNullable: ").Append(ObjectWithNoDeclaredPropsNullable).Append("\n"); sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); @@ -289,18 +289,18 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, JsonTokenType startingTokenType = utf8JsonReader.TokenType; + Option anyTypeProp = default; + Option anyTypePropNullable = default; Option email = default; Option firstName = default; Option id = default; Option lastName = default; Option objectWithNoDeclaredProps = default; + Option objectWithNoDeclaredPropsNullable = default; Option password = default; Option phone = default; Option userStatus = default; Option username = default; - Option anyTypeProp = default; - Option anyTypePropNullable = default; - Option objectWithNoDeclaredPropsNullable = default; while (utf8JsonReader.Read()) { @@ -317,6 +317,14 @@ 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)); + break; + case "anyTypePropNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "email": email = new Option(utf8JsonReader.GetString()); break; @@ -334,6 +342,10 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (utf8JsonReader.TokenType != JsonTokenType.Null) objectWithNoDeclaredProps = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); break; + case "objectWithNoDeclaredPropsNullable": + if (utf8JsonReader.TokenType != JsonTokenType.Null) + objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); + break; case "password": password = new Option(utf8JsonReader.GetString()); break; @@ -347,18 +359,6 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, case "username": username = new Option(utf8JsonReader.GetString()); break; - case "anyTypeProp": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypeProp = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "anyTypePropNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - anyTypePropNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; - case "objectWithNoDeclaredPropsNullable": - if (utf8JsonReader.TokenType != JsonTokenType.Null) - objectWithNoDeclaredPropsNullable = new Option(JsonSerializer.Deserialize(ref utf8JsonReader, jsonSerializerOptions)); - break; default: break; } @@ -392,7 +392,7 @@ public override User Read(ref Utf8JsonReader utf8JsonReader, Type typeToConvert, if (username.IsSet && username.Value == null) throw new ArgumentNullException(nameof(username), "Property is not nullable for class User."); - return new User(email, firstName, id, lastName, objectWithNoDeclaredProps, password, phone, userStatus, username, anyTypeProp, anyTypePropNullable, objectWithNoDeclaredPropsNullable); + return new User(anyTypeProp, anyTypePropNullable, email, firstName, id, lastName, objectWithNoDeclaredProps, objectWithNoDeclaredPropsNullable, password, phone, userStatus, username); } /// @@ -440,6 +440,22 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet && user.Username == null) throw new ArgumentNullException(nameof(user.Username), "Property is required for class User."); + if (user.AnyTypePropOption.IsSet) + if (user.AnyTypePropOption.Value != null) + { + writer.WritePropertyName("anyTypeProp"); + JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypeProp"); + if (user.AnyTypePropNullableOption.IsSet) + if (user.AnyTypePropNullableOption.Value != null) + { + writer.WritePropertyName("anyTypePropNullable"); + JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); + } + else + writer.WriteNull("anyTypePropNullable"); if (user.EmailOption.IsSet) writer.WriteString("email", user.Email); @@ -457,6 +473,14 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer writer.WritePropertyName("objectWithNoDeclaredProps"); JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredProps, jsonSerializerOptions); } + if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) + if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) + { + writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); + JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); + } + else + writer.WriteNull("objectWithNoDeclaredPropsNullable"); if (user.PasswordOption.IsSet) writer.WriteString("password", user.Password); @@ -468,31 +492,6 @@ public void WriteProperties(ref Utf8JsonWriter writer, User user, JsonSerializer if (user.UsernameOption.IsSet) writer.WriteString("username", user.Username); - - if (user.AnyTypePropOption.IsSet) - if (user.AnyTypePropOption.Value != null) - { - writer.WritePropertyName("anyTypeProp"); - JsonSerializer.Serialize(writer, user.AnyTypeProp, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypeProp"); - if (user.AnyTypePropNullableOption.IsSet) - if (user.AnyTypePropNullableOption.Value != null) - { - writer.WritePropertyName("anyTypePropNullable"); - JsonSerializer.Serialize(writer, user.AnyTypePropNullable, jsonSerializerOptions); - } - else - writer.WriteNull("anyTypePropNullable"); - if (user.ObjectWithNoDeclaredPropsNullableOption.IsSet) - if (user.ObjectWithNoDeclaredPropsNullableOption.Value != null) - { - writer.WritePropertyName("objectWithNoDeclaredPropsNullable"); - JsonSerializer.Serialize(writer, user.ObjectWithNoDeclaredPropsNullable, jsonSerializerOptions); - } - else - writer.WriteNull("objectWithNoDeclaredPropsNullable"); } } }